Check the built in function %Date. Today = %Date();
Check the built in function %Date. Today = %Date();
Thanks. The %date BIF worked. But on another subject related to BIFs , I am getting compile errors trying to move a character field to a numeric field. This is in FREE FORMAT also. The character fields come into the program as parameters, as follows: C *ENTRY PLIST C PARM PFYYYY 4 C PARM PTrk# 6 C PARM PReg# 7 The Numeric fields are screen fields described as follows: A SFYYYY 4Y 0B 8 50DSPATR(UL) A EDTCDE(Z) A STRK# 6Y 0B 8 55DSPATR(UL) A EDTCDE(Z) A SREG# 7Y 0B 9 45DSPATR(UL) A EDTCDE(Z) I know that I can do a straight move statement if I am not using FREE FORMAT, but the boss wants to go the FREE FORMAT way. I tried the following statements, but got compiler errors: SFYYYY = PFYYYY; STrk# = PTrk#; SReg# = PReg#; and also SFYYYY = %dec(PFYYYY); STrk# = %dec(PTrk#); SReg# = %dec(PReg#); Can you tell me how to move the character fields to the numeric fields??
here is an example of a program that i wrote and occasionally add lines to to watch in debug, to see what happens. -sarge
Code
Daniel Bizon wrote: > SFYYYY = PFYYYY; > STrk# = PTrk#; > SReg# = PReg#; > and also > SFYYYY = %dec(PFYYYY); > STrk# = %dec(PTrk#); > SReg# = %dec(PReg#); > Can you tell me how to move the character fields to the numeric > fields?? Daniel, You have to define the length and decimal places: SFYYYY = %Dec(PFYYYY:4:0) ; Bill
Pat Landrum wrote: > Check the built in function %Date. > > Today = %Date(); %Date() returns the system date; *DATE is the job date. Chances are that Daniel does really want the system date anyway, but if not, the correct way to get *DATE in a date field is to use Today = %Date(*DATE);
you can also use "atoi" function of C language... bye
Code
Another thing is leading zeros. If you need them to appear exactly in a character field, use the following: SFYYYY = %Editc(PFYYYY:'X');
Can someone tell me how to move the *DATE system value to a D-Spec field that is described as *USA ?? I'm using free format RPG coding. I tried the following statements but got compiler errors. Today = *Date; Today = %Dec(*Date); The D-Spec field is: D Today S D DATFMT(*USA) INZ
If all you want to do is get the system date into a date field you can define the field and initialize it to the system date D Today S D DATFMT(*USA) INZ(*SYS) puts the system date into the field and it is in USA Format too.