70 pts.
 Retreive Stream file size through CL
Hi, How to detemine the file size of a '.TXT' file through CL program? Its a file stored in the IFS folder. Is there any specific command to do this? I need to continuosly look into this folder for the file. Fetch the file size. Wait for some sec and then again retrive the file size. If the size matches means the file was completely copied and hence start processing ithe file. Thanks.

Software/Hardware used:
ASKED: February 25, 2009  11:23 AM
UPDATED: February 25, 2009  1:57 PM

Answer Wiki:
Hi, The following ILE CL program should retrieve the size for you. Be aware that the size in the IFS may not match the size of an object from a library. You can uncomment the SNDPGMMSG commands if you want to see what gets retrieved. You need to pass the IFS object name including path and receive the size in your program (*DEC 15,0). <pre> RTVIFSSIZE: PGM PARM(&IFSOBJ &ALLOCDEC) DCL VAR(&IFSOBJ) 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(15) DCL VAR(&SIZEDEC) TYPE(*DEC) LEN(15 0) DCL VAR(&ALLOCBIN) TYPE(*CHAR) LEN(4) DCL VAR(&ALLOCCHR) TYPE(*CHAR) LEN(15) DCL VAR(&ALLOCDEC) TYPE(*DEC) LEN(15 0) CHGVAR VAR(&IFSOBJ) VALUE(&IFSOBJ *TCAT &NULL) CALLPRC PRC('stat') PARM((&IFSOBJ) (&RECEIVER)) + RTNVAL(%BIN(&RTNVALBIN)) CHGVAR VAR(&RTNVALDEC) VALUE(%BIN(&RTNVALBIN)) IF COND(&RTNVALDEC *NE 0) THEN(SNDPGMMSG + MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA('IFS + OBJECT ' *CAT &IFSOBJ *TCAT ' NOT FOUND') + MSGTYPE(*ESCAPE)) CHGVAR VAR(&SIZEBIN) VALUE(%SST(&RECEIVER 21 4)) CHGVAR VAR(&SIZEDEC) VALUE(%BIN(&SIZEBIN)) CHGVAR VAR(&SIZECHR) VALUE(&SIZEDEC) /* SNDPGMMSG MSG('The object is' *BCAT &SIZECHR *BCAT + 'bytes') */ CHGVAR VAR(&ALLOCBIN) VALUE(%SST(&RECEIVER 45 4)) CHGVAR VAR(&ALLOCDEC) VALUE(%BIN(&ALLOCBIN)) CHGVAR VAR(&ALLOCCHR) VALUE(&ALLOCDEC) /* SNDPGMMSG MSG('The object uses' *BCAT &ALLOCCHR *BCAT + 'bytes disk space') */ ENDPGM </pre> Regards, Martin Gilbert.
Last Wiki Answer Submitted:  February 25, 2009  1:57 pm  by  Gilly400   23,625 pts.
All Answer Wiki Contributors:  Gilly400   23,625 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _