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

How to set on/off a group of indicators in a single statement?

3 Answers  


what is meant by record lock.how records are locked.what is the purpose of record lock.if records are locked what happens.how to find out which record is locked.

4 Answers   HCL,


In case if I want to know whether a record exists in a file, which one do you prefer CHAIN or a SETLL and why ?

1 Answers  


1.Are there any errors in the following statement?If so then list them.DTAARA is a data area having a field EMP # and EMPNO is a field in the file EMPPF.Which has one record. READ EMPPF IF %FOUND(EMPPF) IN DTAARA EVAL EMP#=EMPNO OUT DTAARA ENDIF

5 Answers  


which MONMSG will give higher priority in CL program? I know MONMSG are of two types. Program Level Monmsg and Command Monmsg?

1 Answers  






How can we read a particular record from the database file which is not having DDS (Flat File). For example, there are 100 records in the flat file. How can we retrive 15th record in RPG/400 program (Without using CL)

6 Answers   CTS, IBM,


do you use message subfiles? What are the necessary keywords required coding a message subfile?

0 Answers   IBM,


Hi friends, I am using a load all subfile , and currently i am in in the third page of the subfile , from third page i have selected a record and called some other program .on returning, subfile is being loaded from the frist page. so can any one kindly suggest me in retaining my third page after returning. i.e loading from third page.

7 Answers  


am 2010 passed out . can any one tell me which course is good to put 2+fake .guide me

1 Answers  


i want code and what are used key words are ...like wrkmbrpdm screen (q) i have a file with 3 fields empno,empname,empaddr... here you give the empno it displays from that number to remaining empno's how? sub file screen: employee details pos to:empno then enter empno empname empaddr so file have 100 records from 1 to 100 so the above pos you give the 55 empno...it displays the from 55 to remaining... ...... please share this answel

2 Answers   IBM,


what are the key words you must use when using a subfile?

0 Answers   IBM,


how we retrieve records without using key field (ex:name) from Physical File through RPG in as/400?

8 Answers  


Categories