|
>Does anyone know if there are any APIs which expose the variables used
>in an RPG program?
>I want to write a small utility to see what indicators are left
>available in an RPG without having to look at a compile listing.
Mike
fraid i'm not sure about any API's to do this but......
heres a (very!) quick pgm I knocked up which will identify indicators
used in OPM pgms only
(nb the pgm makes an assumption that the 1st valid line is between
100.00 and 999.00 ....)
PGM PARM(&PGM)
DCL VAR(&PGM) TYPE(*CHAR) LEN(10)
DCL VAR(&STMTNO) TYPE(*DEC) LEN(5) VALUE(10000)
DCL VAR(&STMT) TYPE(*CHAR) LEN(5)
DCL VAR(&INDNO) TYPE(*DEC) LEN(2) VALUE(1)
DCL VAR(&IND) TYPE(*CHAR) LEN(2)
DCL VAR(&INDICATOR) TYPE(*CHAR) LEN(5)
STRDBG PGM(&PGM) DSPMODSRC(*NO)
MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(EXIT))
GET_STMT:
CHGVAR VAR(&STMT) VALUE(&STMTNO)
ADDBKP STMT(&STMT)
/* NOT OPM */
MONMSG MSGID(CPF1902) EXEC(GOTO ENDDBG)
/* STMT NF */
MONMSG MSGID(CPF1999) EXEC(DO)
/* GIVE UP ? */
IF COND(&STMTNO *GT 99800) THEN(GOTO ENDDBG)
CHGVAR VAR(&STMTNO) VALUE(&STMTNO + 100)
GOTO CMDLBL(GET_STMT)
ENDDO
CHECK_IND:
CHGVAR VAR(&IND) VALUE(&INDNO)
CHGVAR VAR(&INDICATOR) VALUE('*IN' || &IND)
ADDBKP STMT(&STMT) PGMVAR(&INDICATOR)
/* INDICATOR NOT USED */
MONMSG MSGID(CPF1999) EXEC(GOTO NEXT_IND)
SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) +
MSGDTA('Indicator ' || &indicator || +
' used') TOPGMQ(*EXT) MSGTYPE(*STATUS)
DLYJOB DLY(1)
NEXT_IND:
IF COND(&INDNO *LT 99) THEN(DO)
CHGVAR VAR(&INDNO) VALUE(&INDNO + 1)
GOTO CMDLBL(CHECK_IND)
ENDDO
ENDDBG:
ENDDBG
EXIT:
ENDPGM
###########################################
This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange.
For more information, connect to http://www.F-Secure.com/
**********************************************************************
The information transmitted is intended only for use by the addressee and may
contain confidential and/or privileged material. Any review, re-transmission,
dissemination or other use of it, or the taking of any action in reliance upon
this information by persons and/or entities other than the intended recipient
is prohibited. If you received this in error, please inform the sender and/or
addressee immediately and delete the material. Thank you
**********************************************************************
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.