Mr.Sidc sirfor my question{how to convert date format from
one format to another i think
in CL/400 its CVTDAT,Please tell in RPG/400 sir not in
RPGILE}
you have answered using MOVE opcode,can you illustrate me
with a small example sir very kind of you.



Mr.Sidc sirfor my question{how to convert date format from one format to another i think in CL/4..

Answer / katiyar

A simple method, if you are good user of MOVE and MOVEL. Use
the below code to change date format of one type to another.

movel *date date1 4 0
move *date date2 4 0

move date1 datex
movel date2 datex

Where *date system defined date with mmddyyyy format. Hope
it will help.

===========================================================
Second method, You need to define Data Structure, as below.
Variable starts with 'F' is actually used for first type of
date.

And variable starts with 'S' actually used for second date
format.

I DS
I 1 80FDATE
I 1 40FYEAR
I 1 20FCC
I 3 40FYY
I 5 120SDATE
I 5 60SMO
I 7 80SDA
I 9 120SYEAR
I 9 100SCC
I 11 120SYY


FDATE is 8-digit date as YYYY/MM/DD format and SDATE is an
8-digit date as MM/DD/YYYY format.

Just convert by moving on to other. For MDY to ISO , use
below syntax.

Z-ADD MDYC SDATE
Z-ADD SYEAR FYEAR
Z-ADD FDATE CYMD

To go from ISO to MDY, you first z-add to fdate, then z-add
fyear to syear, and then z-add sdate into your MDY date.
==========================================================

Is This Answer Correct ?    6 Yes 0 No

Post New Answer

More RPG400 Interview Questions

1.Where we declare Variables in RPG/400,RPGIV,RPGILE.? 2.When do we use D-spec and I-spec in real time ?.what is difference between them?

1 Answers   HP,


This is my Physical file 'EMPS' existing in library "TAMIL1" and its record format is 'EMPRCD" a)its source is R EMPRCD ENO 4 0 ENAME 10 EADD 10 b)The records present in EMPS are as follows ENO ENAME EADD 0001 tamil coimbatore 0002 kumar bangalore 0003 sunder bangalore 0004 arunkumar chennai 0005 pandi hyderabad 0006 santhosh hyderabad 0007 sasi salem 0008 kalai chennai 0009 suresh hyderabad 0010 vijay bangalore 0011 Arul chennai 0012 velu chennai 0013 khan bangalore 0014 praba chennai 0015 praba.p coimbatore 0016 anand ooty 0017 raja erode 0018 sankar erode 0019 vadivel namakkal 0020 anbu chennai 0021 Ajith mumabi c)now i want to select the 'ENAME' field records starting with 'S' for that i have created a RPG program its source code is PGM DCLF FILE(TAMIL1/EMPS) DCL VAR(&MYENO) TYPE(*CHAR) LEN(4) OVRDBF FILE(EMPS) SHARE(*YES) OPNQRYF FILE((TAMIL1/EMPS)) QRYSLT('ENAME *EQ %WLDCRD("S *")') READ: RCVF RCDFMT(EMPRCD) MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(END)) CHGVAR VAR(&MYENO) VALUE(&ENO) SNDUSRMSG MSG(&MYENO) SNDUSRMSG MSG(&ENAME) SNDUSRMSG MSG(&EADD) GOTO READ END: CLOF OPNID(EMPS) DLTOVR FILE(EMPS) ENDPGM Is this coding correct sir,the program gets compiled,and if i call it it says query running but records are not displayed.please help me out

4 Answers   Virtusa,


we hav job which is running as batch. it takes atleast 06hours to complete tht job. bu i wana do tht job with in 3hours.........? so plz post ur answers

8 Answers   Cap Gemini, IBM,


I know chain keyword retreive records randomly but how chain keyword exactly works internally????

4 Answers  


What is I90(Insure 90)?

1 Answers  






What would be the effect on the field where reverse image, underline and high intensity?

7 Answers   IBM,


Delete FileName at first statement in RPG.

1 Answers  


What is the difference Return and InLr?

3 Answers  


I have some doubts on subfile----------- -----I wrote a prog on subfile to display the records. Every thing is clear but i defined a field called "opt" as input field in subfile record format from that input field i wish to enter into new screen called "EDIT" which i created it as a separate RCD in display file. i gave opt as 2 for edit just like in WRKMBRPDM screen please telll me the code and how can i code for it in RPG.

3 Answers  


can anybody explain significance of *loval setll with example code????

3 Answers   HSBC,


difference between CHAIN and READE?

8 Answers   HCL,


while i am using the dspmsg command on comman line in Mocha am getting error like Not authorized to message queue message my messagequeue Name? can anybody help me how to change my message queue Am anable to see my messages in message queue

1 Answers  


Categories