星期二, 11月 07, 2023

2007-06-05 如何取得現有系統支援的 OS 版本 ?(API QSZRTVPR, QSZCHKTG)


如何取得現有系統支援的 OS 版本 ?(API QSZRTVPR, QSZCHKTG)
(如編譯程式參數 TGTRLS 及 SAVLIB,SAVOBJ參數 TGTRLS)
當你想讓備份程式自動指定非現有 TGTRLS 時,就可利用此 API 取得現有系統所支援的舊版本 OS.


File  : QCLSRC
Member: CHKTGTRLSC
Type  : CLP
Usage : CRTCLPGM CHKTGTRLSC
        CALL CHKTGTRLSC
Reference:
      Retrieve Product Information (QSZRTVPR) retrieves information about a specific product load for a software product
      http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/apis/qszrtvpr.htm
      
      Check Target Release (QSZCHKTG) verifies that a valid target release value is specified on a CL command that supports the TGTRLS parameter
      http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/apis/qszchktg.htm

PGM

 DCL     &RELEASE    *CHAR  6
 DCL     &TGTRLS     *CHAR  10
 DCL     &VLDTGTRLS  *CHAR   6
 DCL     &SPTRLSOS   *CHAR   6
 DCL     &RCVR       *CHAR  784
 DCL     &RCVRLEN    *CHAR  4      VALUE(X'00000310')
 DCL     &FORMAT     *CHAR  8      VALUE('PRDR0700')
 DCL     &PRDINFO    *CHAR  27     VALUE('*OPSYS V1R3M00000*CODE     ')
 DCL     &ERRCODE    *CHAR  4      VALUE(X'00000000')
 DCL     &BYTRTN     *DEC   5 0
 DCL     &NBRRLSRTN  *DEC   5 0
 DCL     &STROFFSET  *DEC   5 0
 DCL     &IDX        *DEC   5 0
 DCL     &NBRSPTRLSC *CHAR  4

 CALL QSYS/QSZRTVPR PARM(&RCVR &RCVRLEN &FORMAT &PRDINFO &ERRCODE)

 CHGVAR  &BYTRTN  %BIN(&RCVR 5 4)
 CHGVAR  &NBRRLSRTN  %BIN(&RCVR 9 4)
 CHGVAR  &IDX         1
 CHGVAR  &STROFFSET  17

LOOP:
 IF (&IDX *GT &NBRRLSRTN) GOTO END

 CHGVAR &RELEASE (%SST(&RCVR &STROFFSET 6))

 CHGVAR &TGTRLS &RELEASE
 CHGVAR %BIN(&NBRSPTRLSC)  1
 CHGVAR &ERRCODE X'00000000'

 CALL QSYS/QSZCHKTG PARM(&TGTRLS '*SAV' &NBRSPTRLSC &VLDTGTRLS +
                         &SPTRLSOS &ERRCODE)
 MONMSG CPF0C35 *N GOTO NEXT

 SNDPGMMSG MSG('THIS SYSTEM SUPPORT RELEASE' |> &VLDTGTRLS)

NEXT:

 CHGVAR &IDX (&IDX + 1)
 CHGVAR &STROFFSET (&STROFFSET + 6)

 GOTO LOOP

END:

ENDPGM


                       




沒有留言: