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

i want to perform uniqness on db file bt my db file nt hving key by useing rpgle.

3 Answers   HSBC,


How do you proceed in case your active AS400 session has got disconnected suddenly, how can you get back to your session ? Is it possible??

1 Answers  


One of the job in subsystem is in Running status,expected time to complete this job is 2 minutes. But from last 5 -10 minutes this job is still in running status....What are the possible reasons...and What are the actions i need to perform to check this...?

4 Answers  


Hi,Please give me complete code with this logic. The question is how to read the records from a file with load an array of size with error condition? (The logic is Z-Add 0 IDX *LOVAL SETLL FILE READ FILE 99 *IN9 DOWEQ *OFF IDX ANDLT 99 ADD 1 IDX MOVE FIELD ARR,IDX READ FILE 99 ENDDO)please give me complete code with explanation?

1 Answers  


suppose a job is running for 15 minutes after that it goes to message wait? what are the impact analysis

1 Answers  






Can you copy the records created by the OPNQRYF to other files and how?

2 Answers  


Q1.How we can copy the data of file one session to another session? Q2.how we can execute a loop infinitely in AS/400 coding? Q3.In ALDON tool,multitask is posible on a perticular object by the user?

6 Answers   CSC,


What will happen if we r using seton lr after return or vice versa.

5 Answers  


WHAT IS MEANT BY SIGNATURE VAILOTION ERROR

1 Answers   IBM,


how do I preserve and clean the array?

0 Answers   IBM,


this is rpg3 code W0RTN IFEQ @CN,002 what is the means @CN,002

1 Answers  


How to handle duplicate error handling in RPG?

0 Answers  


Categories