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

what is program status data structure?

1391


is this a rpg channel?

681


what is the use of sflnxtchg?

805


Set on command is used for closed all opened files , initialize var and release resource , return cmd is used for return to calling program but my req. Is dnt close opened files and resource must released while doing transactions , how can i do this...?

1464


How many program bind in one module....

2125






What is the purpose of record level identifier?

730


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

1297


Please tell me how to read the records from a file with load an array of size with error conditions(The logic answer for this question is ARR is array of 99 elements Z-ADD 0 IDX *LOVAL SETLL FILE READ FILE 99 *IN99 DOWEQ *OFF IDX ANDLT 99 ADD 1 IDX MOVE FIELD ARR,IDX READ FILE 99 ENDDO).So,Please give me the complete of this code.

2054


Q:Hi all,i want accurate answer with code using in built functions.please sent me code as soon as posible. I have program nmed PGM1 which '' RETRIEVE Current production date''should correctly default the production date for the user who is issuing raw materials to the manufacturing.The production date can be different from the celendra date. However, the program does not make the correct adjustment for all manufacturing plants. there is a parameter which determines the production start time e.g. 07:00 if the system time precedes this,the program subtracts one from the celendra day.This work fine when the celendar day starts after production day as it does in England,the system should be adding one to the celendar day during the overlap. unfortunately the program was desined to assumed the celendar day always starts before the production day. Change required in the program: Change the PROGRAM PGM1 to use the new parrameter to decide whether to add or subtract 1 from the celendar day when determining the production date.

1764


We have job which is running as batch. It takes atleast 06 hours to complete tht job. But I wanna do tht job with in 3 hours?

773


What is a record lock error?

1270


Hi Viewers can any body explain me how to update and ahange the already existed data in physical file using subfile ? please explain me with the code if possible?

4213


how do I preserve and clean the array?

677


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

748


can anybody help me to solve this problem. the program that i m checking display error message saying "Record format for file AJDSPFFD does not match model file and decimal error. how to solve this problem. The AJDSPFFD is snapshot the AJTLOG that is the audit trail list.

2281