-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0872e5d
commit 270e213
Showing
1 changed file
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
PGM PARM(&IFSFILE &SIZEDEC &ALLOCDEC &ESCONERROR) | ||
|
||
DCL VAR(&ESCONERROR) TYPE(*CHAR) LEN(4) | ||
DCL VAR(&IFSFILE) TYPE(*CHAR) LEN(256) | ||
DCL VAR(&IFSFILE2) TYPE(*CHAR) LEN(256) | ||
DCL VAR(&RTNVALBIN) TYPE(*CHAR) LEN(4) | ||
DCL VAR(&RTNVALDEC) TYPE(*DEC) LEN(5 0) | ||
DCL VAR(&RECEIVER) TYPE(*CHAR) LEN(4096) | ||
DCL VAR(&NULL) TYPE(*CHAR) LEN(1) VALUE(X'00') | ||
DCL VAR(&SIZEBIN) TYPE(*CHAR) LEN(4) | ||
DCL VAR(&SIZECHR) TYPE(*CHAR) LEN(9) | ||
DCL VAR(&SIZEDEC) TYPE(*DEC) LEN(10 0) | ||
DCL VAR(&ALLOCBIN) TYPE(*CHAR) LEN(4) | ||
DCL VAR(&ALLOCCHR) TYPE(*CHAR) LEN(9) | ||
DCL VAR(&ALLOCDEC) TYPE(*DEC) LEN(10 0) | ||
|
||
MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(ERRORS)) | ||
|
||
CHGVAR VAR(&SIZEDEC) VALUE(0) | ||
CHGVAR VAR(&ALLOCDEC) VALUE(0) | ||
|
||
CHGVAR VAR(&IFSFILE2) VALUE(&IFSFILE *TCAT &NULL) | ||
|
||
CALLPRC PRC('stat') PARM(&IFSFILE2 &RECEIVER) + | ||
RTNVAL(%BIN(&RTNVALBIN)) | ||
|
||
CHGVAR VAR(&RTNVALDEC) VALUE(%BIN(&RTNVALBIN)) | ||
|
||
/* If errors occurred */ | ||
IF COND(&RTNVALDEC *NE 0) THEN(DO) | ||
|
||
IF COND(&ESCONERROR *EQ *YES) THEN(DO) | ||
SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA('IFS + | ||
object ' |> &IFSFILE |< ' not found') + | ||
MSGTYPE(*ESCAPE) | ||
ENDDO | ||
|
||
IF COND(&ESCONERROR *NE *YES) THEN(DO) | ||
/* Set negative return code on errors and rtn diag msg */ | ||
CHGVAR VAR(&SIZEDEC) VALUE(-2) | ||
CHGVAR VAR(&ALLOCDEC) VALUE(-2) | ||
SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA('IFS + | ||
object ' |> &IFSFILE |< ' not found') + | ||
MSGTYPE(*DIAG) | ||
RETURN | ||
ENDDO | ||
|
||
ENDDO | ||
|
||
CHGVAR VAR(&SIZEBIN) VALUE(%SST(&RECEIVER 21 4)) | ||
CHGVAR VAR(&SIZEDEC) VALUE(%BIN(&SIZEBIN)) | ||
CHGVAR VAR(&SIZECHR) VALUE(&SIZEDEC) | ||
SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA('The + | ||
number of data bytes in the file is' |> + | ||
&SIZECHR) TOPGMQ(*PRV) | ||
|
||
CHGVAR VAR(&ALLOCBIN) VALUE(%SST(&RECEIVER 45 4)) | ||
CHGVAR VAR(&ALLOCDEC) VALUE(%BIN(&ALLOCBIN)) | ||
CHGVAR VAR(&ALLOCCHR) VALUE(&ALLOCDEC) | ||
SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA('The + | ||
number of bytes allocated to the file is + | ||
' |> &ALLOCCHR) TOPGMQ(*PRV) MSGTYPE(*INFO) | ||
RETURN | ||
ERRORS: | ||
/* Set negative return code on errors and rtn diag msg */ | ||
CHGVAR VAR(&SIZEDEC) VALUE(-2) | ||
CHGVAR VAR(&ALLOCDEC) VALUE(-2) | ||
|
||
IF COND(&ESCONERROR *EQ *YES) THEN(DO) | ||
SNDPGMMSG MSGID(CPF9898) MSGF(AQCPFMSG) MSGDTA('Error + | ||
checking IFS file size for' |> &IFSFILE) + | ||
TOPGMQ(*PRV) MSGTYPE(*ESCAPE) | ||
ENDDO | ||
IF COND(&ESCONERROR *NE *YES) THEN(DO) | ||
SNDPGMMSG MSGID(CPF9898) MSGF(AQCPFMSG) MSGDTA('Error + | ||
checking IFS file size for' |> &IFSFILE) + | ||
TOPGMQ(*PRV) MSGTYPE(*DIAG) | ||
ENDDO | ||
|
||
ENDPGM |