× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



FWIW... this is how I typically do it:

PGM

    DCL VAR(&SYSDATE) TYPE(*CHAR) LEN(6)
    DCL VAR(&TAPLBL)  TYPE(*CHAR) LEN(6)

    RTVSYSVAL SYSVAL(QDATE) RTNVAR(&SYSDATE)
    CVTDAT DATE(&SYSDATE)  FROMFMT(*SYSVAL) +
           TOVAR(&TAPLBL)  TOFMT(*YMD) TOSEP(*NONE)

ENDPGM



On 8/8/2023 3:30 AM, Patrik Schindler wrote:
Hello,

I want my Save 21 tapes are meant to have a label YYMMDD applied without much manual information. I began to write a CL program like this:

DCL VAR(&TAPDRV) TYPE(*CHAR) LEN(5) VALUE(TAP01)
DCL VAR(&SYSYR) TYPE(*CHAR) LEN(2)
DCL VAR(&SYSMON) TYPE(*CHAR) LEN(2)
DCL VAR(&SYSDAY) TYPE(*CHAR) LEN(2)
DCL VAR(&TAPLBL) TYPE(*CHAR) LEN(6)

RTVSYSVAL SYSVAL(QYEAR) RTNVAR(&SYSYR)
RTVSYSVAL SYSVAL(QMONTH) RTNVAR(&SYSMON)
RTVSYSVAL SYSVAL(QDAY) RTNVAR(&SYSDAY)

CHGVAR VAR(&TAPLBL) VALUE(&SYSYR *CAT &SYSMON *CAT &SYSDAY)

Unfortunately, the system values aren't padded with 0's when single-digit which creates ambiguity.

I could hard code 18 lines of "if day equals 1 then change variable to be 01", and so on. This seems to be pretty ugly. How would you solve this in CL(LE)?

Thanks!

:wq! PoC


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.