Show 2 ways to convert a date from YYMMDD to MMDDYY (MULT operation not acceptable)
Answer Posted / 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 |
Post New Answer View All Answers
when are the referential constraints executed?
What is the use of jdftval in as400?
what is the version of os/400 that we have?
what is scan and xlate?
different type of cursor?
which are the string manipulation opcodes?
where will control be passed after the execution of the *pssr subroutine if the factor2 of the endsr is blank ?
what is a composite key?
is there any way I can ease my rpg controls on numeric input fields? How about an input date field?
what is match field indicator?
what are the important factors in error message subfile ?
What are the mandatory keywords of sub file?
if we tried to move year part of *iso date into a field of length 3, what will happen ?
what the purpose of ovrdta, ovrata keywords?
how to validate input values in display file ?