I want to add 10 days in current date. how it is possible in
CL program...?

Answer Posted / c4

TAATOOLS are nice but can get lost, messed up or not be loaded.
This gets the date a week back.
To add change date to YY001 if days are greater than 365 or 366 depending on leap year.


/* GO BACK A WEEK*/
DOFOR VAR(&INT) FROM(1) TO(7)
CVTDAT DATE(&DATE) TOVAR(&JULIAN) TOFMT(*JUL) +
TOSEP(*NONE)
CHGVAR VAR(&DECJULIAN) VALUE(&JULIAN)
CHGVAR VAR(&DECJULIAN) VALUE(&DECJULIAN - 1)
CHGVAR VAR(&JULIAN) VALUE(&DECJULIAN)

/* CHECK IF DECEMBER 31 */
IF COND(%SST(&JULIAN 3 3) *EQ '000') THEN(DO)
CHGVAR VAR(&YEAR#) VALUE(&YEAR)
CHGVAR VAR(&YEAR#) VALUE(&YEAR# - 1)
CHGVAR VAR(&YEAR) VALUE(&YEAR#)
/* CHECK IF LEAP YEAR */
CHGVAR VAR(&REM) VALUE(&YEAR# / 4)
CHGVAR VAR(&REM) VALUE(&REM * 4)
IF COND((&YEAR# - &REM) *EQ 0) THEN(DO)
CHGVAR VAR(&JULIAN) VALUE(&YEAR || '366')
ENDDO
ELSE DO

Is This Answer Correct ?    1 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How Chain operation copies the record's data to the input buffer for the program?

1084


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

694


What is ment by record level identifier?

660


explain sflclr, sflend, sfldlt, and sflcsrrrn?

891


How do u design a physical file, when you have 2 Unique fields like for eg in A student file student ID and student examination no both are unique

553






how can I tell when to replace the array?

706


What is difference between bind by copy and bind by reference?

1736


what is a rpg?

705


give an eg of ACQ-(ACQUIRE),BIT OFF,BIT ON,DEALLOC,DUMP,FEOD,FORCE,MHHZO,MHLZO,MHLLZO,MLHZO,REL,RESET,TESTZ,TESTB,TESTN----GIVE SMALL EXAMPLE TO THE OPCODES...TO UNDERSTAND FUNCTIONING...........

3291


how do you use commitment control in rpg?

761


what is *place and *auto keyword in prtf ?plz explain

2732


write an RPG program to calculate the marks of 5 students (A,B, C, D, E)in 3 different subjects (eng, math, sci) an display on the screen

835


How to declare the pull button in AS/400..

1884


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

741


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.

760