I want to add 10 days in current date. how it is possible in
CL program...?
Answers were Sorted based on User's Feedback
Answer / arjun
hi kumar and prakash, there is No ADDDATE command in cl.How
can u give? plz tell me? i wanted know.how 2 add days?
| Is This Answer Correct ? | 7 Yes | 1 No |
Answer / kanika
convert the date to julian format ,chg varaible from char to dec , add 10 using chgvar,again chgvar to char type,do cnvtdat from julain to whatever format you want the output.
| Is This Answer Correct ? | 2 Yes | 2 No |
Answer / 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 |
Answer / chandrababu
We can add 10 days to current date as below..
DCL VAR(&DAY) TYPE(*CHAR) LEN(2)
DCL VAR(&D1) TYPE(*DEC) LEN(2)
DCL VAR(&MONTH) TYPE(*CHAR) LEN(2)
DCL VAR(&YEAR) TYPE(*CHAR) LEN(2)
RTVSYSVAL SYSVAL(QDAY) RTNVAR(&DAY)
RTVSYSVAL SYSVAL(QMONTH) RTNVAR(&MONTH)
RTVSYSVAL SYSVAL(QYEAR) RTNVAR(&YEAR)
SNDUSRMSG MSG(&DAY *CAT &MONTH *CAT &YEAR)
CHGVAR &D1 &DAY
CHGVAR &D1 (&D1 + 10)
CHGVAR &DAY &D1
SNDUSRMSG MSG(&DAY *CAT &MONTH *CAT &YEAR)
Also you can covert this date by using CVTDAT to any date format you like...
| Is This Answer Correct ? | 4 Yes | 6 No |
Answer / john bulloch
DCL VAR(&JOBDATE) TYPE(*CHAR) LEN(6)
DCL VAR(&JULCHAR) TYPE(*CHAR) LEN(5)
DCL VAR(&JULNUM) TYPE(*DEC) LEN(5 0)
DCL VAR(&ISODATE) TYPE(*CHAR) LEN(10)
RTVJOBA DATE(&JOBDATE)
CVTDAT DATE(&JOBDATE) TOVAR(&JULCHAR) FROMFMT(*DMY) +
TOFMT(*JUL) TOSEP(*NONE)
CHGVAR VAR(&JULNUM) VALUE(&JULCHAR)
CHGVAR VAR(&JULNUM) VALUE(&JULNUM -10)
CHGVAR VAR(&JULCHAR) VALUE(&JULNUM)
CVTDAT DATE(&JULCHAR) TOVAR(&ISODATE) FROMFMT(*JUL) +
TOFMT(*ISO)
| Is This Answer Correct ? | 0 Yes | 2 No |
Answer / pushyami tulluri
PGM
DCL VAR(&DATE) TYPE(*CHAR) LEN(6)
DCL VAR(&NUMVAR) TYPE(*CHAR) LEN(8)
DCL VAR(&NUMVAR1) TYPE(*CHAR) LEN(5)
DCL VAR(&NUMVAR2) TYPE(*DEC) LEN(5)
RTVSYSVAL SYSVAL(QDATE) RTNVAR
(&DATE)
CVTDAT DATE(&DATE) TOVAR(&NUMVAR) FROMFMT
(*MDY) +
TOFMT(*YMD) TOSEP(*none)
CHGVAR &NUMVAR1 %SST(&NUMVAR 5 2)
SNDUSRMSG MSG('NUMVARIBLE' ||
&NUMVAR1)
CHGVAR &NUMVAR2
&NUMVAR1
CHGVAR &NUMVAR2 (&NUMVAR2 +
10)
/* CHGVAR &NUMVAR1 &NUMVAR2
*/
CHGVAR %SST(&NUMVAR 5 2)
&NUMVAR2
SNDUSRMSG MSG('CURRENT DATE:' ||
&NUMVAR)
ENDPGM
| Is This Answer Correct ? | 2 Yes | 5 No |
Answer / vichu
TRY USING THE DATE FUNCTION FOLLOWED BY FUNCTION DATE-OF-
INTEGER /FUNCTION INTEGER-OF-DATE as per ur requirement
| Is This Answer Correct ? | 2 Yes | 7 No |
Answer / prakash
PGM
DCL VAR(&DATE) TYPE(*Char) Len(6)
RTVSYSVAL SYSVAL(QDATE) RTNVAR(&DATE)
ADDDATE DAYS(10) TOVAR(&DATE) TOVARFMT(*SYSVAL) +
DATEFMT(*SYSVAL)
ENDPGM
| Is This Answer Correct ? | 1 Yes | 9 No |
If the last record of a file has been read, and the next operation on that file is a READ operation, what will be the values of the input fields for that file? A. They will be blank and/or zero. B. They will be null. C. They will equal the values of the first record in the file. D. They will equal the values of the last record read.
How can we call CL program to RPG? How many number of parameter we can pass
suppose one file is used by 100 user and file is locked by 100 user, what are the impact analysis?
Suppose we have 10 records with same name and we are reading using READE,after 4 record i have to use CHAIN what is the output
How to create a login screen using a command instead of display file.... intention is to get a password field on a command..... how do you achieve this...
Suppose we add one field in physical file and this physical file is used by several programs.how do we know which program is using that file? What are the impact analysis.
HOW TO DELETE THE RECORD FROM MASTER FILE WHICH IS LINK BY ANOTHER TRASATION FILE WITH REFERTIAL INTYGRITY?
In how many ways a session/device error occurs,,, and what is the remedy for it?
what is kids-rpg?
1.How can you search an entire source file for a particular field name? 2.How can you find the differences between two versions of the source for the same program? 3.What is a hidden field as it relates to a sub file? 4.How do you display a sub file that has no records in the sub file?
How do you find whether a job is a batch job or interactive?
Hi, I am getting the error in RPG (All Record Formats for externally-described file ABCD ignored or dropped due to error; file ignored.) Please suggest any