Show 2 ways to convert a date from YYMMDD to MMDDYY (MULT operation not acceptable)
Answer / sanjeet kumar
1)CVTDAT() DATE() RTNVAR() FROMFMT() TOFMT()
Source code is required to convert from one date format to another date format.
The source code in CLP is given below:
PGM
DCL VAR(&VAR1) LENGTH(6) TYPE(*CHAR) VALUE('YYMMDD')
DCL VAR(&RCVD) LENGTH(6) TYPE(*CHAR)
DCL VAR(&VAR2) LENGTH(4) TYPE(*CHAR)
DCL VAR(&VAR3) LENGTH(2) TYPE(*CHAR)
CHGVAR VAR(&VAR2) VALUE(%SST(&VAR1 3 4))
CHGVAR VAR(&VAR3) VALUE(%SST(&VAR1 1 2))
CHGVAR VAR(&RCVD) VALUE(&VAR2 *CAT &VAR3)
SNDMSG MSG(&RCVD) TOUSR(*USRPRF)
ENDPGM
Is This Answer Correct ? | 0 Yes | 0 No |
what is a query can be run in which mode?
Space & Skip Are Which Level Keywords?
how can you execute a command from within an rpg program without calling a clp program?
How can the user implicitly open and close the files in RPG program ?
pf named karthik 3members jan feb mar cmd must executed create mbr ar ap
How to add 99 menu (page down) option in menu creation..
what is the purpose of putovr (put with explicit override) keyword?
How do you grant authority?
What are the record format field mapping options in cpyf?
what is the difference between udate and the system date?
How to create a user defined (general) data area?
how do you know that records are locked?