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.

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

When it is desirable to describe files Internally?

1178


how do I declare a table or array in rpg iv?

725


during execution, an rpg/400 program automatically follows a sequence of operations for each record that is processed. The built-in program cycle includes the following logical steps.

745


1. If there are two programs using same file and 2 users are using the file at the same time and what can be done to allow them both to access? 2. How can remove lock from the file for accessing it by both users?

474


how do you use commitment control in rpg?

743






what is an online rpg?

711


How to select highest score of each subject or how to select highest income of every month?

1281


are there any useful c runtime apis that I can call from rpg iv?

687


what happens when sflsiz = sflpag? What are the advantages and disadvantages?

702


What is a record lock error?

1254


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

677


can any one help in hawkeye and turnover or any change management system plzzzzz or send the documents to my mail id :gvsp.as4@gmail.com

1952


How can we know running job is batch or interactive?

641


which program rpg or cl is efficent to update a transaction onto a database file and why ?

732


what is file information data structure?

1350