Solved

CL PROGRAM TO CONVERT QDATE

Posted on 2009-06-29
1
1,899 Views
Last Modified: 2013-12-06
I need a simple CL program to convert the current date (QDATE) into the format YYYYMMDD that I can store in a text file.
The existing code is extracting a 2 digit year.

Thanks
0002.00              DCL        VAR(&PDATE) TYPE(*CHAR) LEN(6)
0004.00              DCL        VAR(&CJULIAN) TYPE(*CHAR) LEN(5)
0005.00              DCL        VAR(&DJULIAN) TYPE(*DEC) LEN(6)
0006.00              ADDLIBLE   LIB(PIPRD)
0007.00              MONMSG     MSGID(CPF2100)
0008.00
0009.00
0010.00              RTVSYSVAL  SYSVAL(QDATE) RTNVAR(&PDATE)
0011.00              CVTDAT     DATE(&PDATE) TOVAR(&CJULIAN) FROMFMT(*MDY) +
0012.00                           TOFMT(*JUL) TOSEP(*NONE)
0013.00              CHGVAR     VAR(&DJULIAN) VALUE(&CJULIAN)
0014.00              CHGVAR     VAR(&DJULIAN) VALUE(&DJULIAN + 1)
0015.00  CONVERT:    CHGVAR     VAR(&CJULIAN) VALUE(&DJULIAN)
0016.00              CVTDAT     DATE(&CJULIAN) TOVAR(&PDATE) FROMFMT(*JUL) +
0017.00                           TOFMT(*YMD) TOSEP(*NONE)
0018.00              MONMSG     MSGID(CPF0555) EXEC(DO)
0019.00              CHGVAR     VAR(&DJULIAN) VALUE(1)
0020.00              GOTO       CMDLBL(CONVERT)
0021.00              ENDDO

Open in new window

0
Comment
Question by:a016691
1 Comment
 
LVL 34

Accepted Solution

by:
Gary Patterson earned 500 total points
ID: 24736845
Use CVTDAT to convert the retrieved QDATE value from *SYSVAL format to *YYMD format, or retrieve QDATETIME instead (20A) and substring out the first 8 characters.

- Gary Patterson
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Hibernate on windows 10 18 139
How can i compile this github project?? 2 82
how to update exe applicatio from internet ? 6 76
Recommendation vb6 to vb.net or others 14 141
In this article we will discuss all things related to StageFright bug, the most vulnerable bug of android devices.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now