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


Please Help Members By Posting Answers For Below Questions

when are the referential constraints executed?

642


What is the use of jdftval in as400?

926


what is the version of os/400 that we have?

969


what is scan and xlate?

1101


different type of cursor?

645






which are the string manipulation opcodes?

643


where will control be passed after the execution of the *pssr subroutine if the factor2 of the endsr is blank ?

1128


what is a composite key?

1037


is there any way I can ease my rpg controls on numeric input fields? How about an input date field?

620


what is match field indicator?

1042


what are the important factors in error message subfile ?

576


What are the mandatory keywords of sub file?

754


if we tried to move year part of *iso date into a field of length 3, what will happen ?

662


what the purpose of ovrdta, ovrata keywords?

1197


how to validate input values in display file ?

677