home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Hall of Fame
/
HallofFameCDROM.cdr
/
3x400
/
dupoutf.lzh
/
CPP1740.CLP
next >
Wrap
Text File
|
1985-11-14
|
3KB
|
64 lines
CPP1740: PGM (&FILE &FORMAT &SIZE &MEMBERS)
/* Program - CPP1740 */
/* Duplicates an output file */
/* CPP for command DUPOUTF */
DCL &FILE *CHAR 20
DCL &FORMAT *CHAR 22
DCL &OUTFILE *CHAR 10
DCL &SIZE *CHAR 20
DCL &MEMBERS *DEC 5
DCL &MAXMBRS *CHAR 6
DCL &CNT *DEC 3
DCL &MSGID *CHAR 7
DCL &MSGDTA *CHAR 132
MONMSG MSGID(CPF0000) EXEC(GOTO RCVMSG)
IF (%SST(&FORMAT 03 10) *EQ 'DSPFD') +
CHGVAR VAR(&OUTFILE) VALUE(%SST(&FORMAT 13 10))
ELSE +
CHGVAR VAR(&OUTFILE) VALUE(%SST(&FORMAT 03 10))
DUPOBJ: CRTDUPOBJ OBJ(&OUTFILE) FROMLIB(QSYS) OBJTYPE(*FILE) +
TOLIB(%SST(&FILE 11 10))
RENAME: RNMOBJ OBJ(&OUTFILE.%SST(&FILE 11 10)) +
OBJTYPE(*FILE) NEWOBJ(%SST(&FILE 01 10))
CHGSIZE: IF (%SST(&SIZE 03 05) *EQ '*SAME') GOTO CHGMBRS
IF (%SST(&SIZE 03 05) *EQ '*NOMAX') DO
CHGPF FILE(%SST(&FILE 01 10).%SST(&FILE 11 10)) +
SIZE(*NOMAX)
ENDDO
ELSE DO
CHGPF FILE(%SST(&FILE 01 10).%SST(&FILE 11 10)) +
SIZE(%SST(&SIZE 03 08) +
%SST(&SIZE 11 05) %SST(&SIZE 16 05))
ENDDO
CHGMBRS: IF (&MEMBERS *EQ -1) GOTO ENDPGM /* *SAME */
IF (&MEMBERS *EQ 0) DO /* *NOMAX */
CHGVAR VAR(&MAXMBRS) VALUE('*NOMAX')
ENDDO
ELSE DO
CHGVAR VAR(&MAXMBRS) VALUE(&MEMBERS)
ENDDO
CHGPF FILE(%SST(&FILE 01 10).%SST(&FILE 11 10)) +
MAXMBRS(&MAXMBRS)
RCVMSG: /* Receive and forward program messages. */
RCVMSG RMV(*YES) MSGDTA(&MSGDTA) MSGID(&MSGID)
IF (&MSGID *EQ ' ') RETURN
IF (%SST(&MSGID 1 2) *EQ 'CP' +
*OR %SST(&MSGID 1 3) *EQ 'MCH') DO
IF (&MSGDTA *EQ ' ') SNDPGMMSG MSGID(&MSGID) +
MSGF(QCPFMSG) TOPGMQ(*PRV) MSGTYPE(*DIAG)
ELSE SNDPGMMSG MSGID(&MSGID) MSGF(QCPFMSG) +
MSGDTA(&MSGDTA) TOPGMQ(*PRV) MSGTYPE(*DIAG)
CHGVAR VAR(&CNT) VALUE(&CNT + 1)
ENDDO
IF (&CNT *LT 10) GOTO RCVMSG
ENDPGM: ENDPGM