home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Hall of Fame
/
HallofFameCDROM.cdr
/
3x400
/
qryf.lzh
/
QRYFR.RPG
< prev
Wrap
Text File
|
1987-09-04
|
13KB
|
217 lines
*-PANDOL RPGIII PROGRAM DESCRIPTION---------------------------------
* REPORT TITLE: None
*
* PURPOSE: CCP for the QRYF command. Creates UDS statements for
* the CRTQRYAPP command and reformat utility copy file
* control records
* METHOD: Refer to the S/38 Query Utility Reference Manual
* Source Statement Syntax
* This program creates the source statements based upon
* the parms passed to it by the QRYF command.
* The variable list FLDS contains 1 occurance for each
* query field (limit 10). These are moved into the FLD
* data structure for processing.
*
* INVOKED: QRYF command --> QRYF CLP --> QRYFR
* CALLS: None
* SCHEDULE: On request
*
* PROGRAMMER: Robert Hughes DATE: 08/87
* REVISED: F------- L-------- DATE: mm/yy
* REASON:
*
*--------------------------------------------------------------
FQCLSRC O F 92 DISK
FQCLSRC2 O F 92 DISK
E CL 1 12 65 QRY DEF
E SKP 11 1 SKIP PARM FLAG
E SRT 9 10 SORT FIELDS
E C 65 1 WORK FOR CL
E WRK 510 1 STRING ARRAY
IFLD DS
I 1 2 SPAC1
I 3 12 FIELD
I 13 13 OPR
I 14 14 EDIT
I 15 15 SPB
I 16 17 SPAC2
I B 18 190L#
I 20 29 LB1
I 30 39 LB2
I 40 49 LB3
IFLDS DS
I B 1 20F#
I 3 512 WRK
IBIN2 DS
I B 1 20B2
C *ENTRY PLIST
C PARM FILE 21
C PARM FMT 10
C PARM TITLE 32
C PARM FLDS
*-------------------------------------------------------------------
C DO 4 SEQ 60 LOOP THRU 1ST 4
*--------------------------
C SEQ IFEQ 1 IF QRYAPP
C MOVEACL,SEQ C LOAD WORK
C MOVEAFILE C,15 LOAD DATA
C EXCPTOUTPUT WRITE DEF
C END END
*--------------------------
C SEQ IFEQ 2 IF 1ST OUTPUT
C MOVEACL,SEQ C LOAD WORK
C MOVEATITLE C,15 LOAD DATA
C EXCPTOUTPUT WRITE DEF
C END END
*--------------------------
C SEQ IFEQ 3 IF 2ND OUTPUT
C MOVEACL,SEQ C LOAD WORK
C MOVEATITLE C,15 LOAD DATA
C EXCPTOUTPUT WRITE DEF
C END END
*--------------------------
C SEQ IFEQ 4 IF QRYFMT
C MOVEACL,SEQ C LOAD WORK
C MOVEAFMT C,15 LOAD DATA
C EXCPTOUTPUT WRITE DEF
C END END
*--------------------------
C END DO 4
*-------------------------------------------------------------------
C DO F# K 30 DO FOR EA FLD
C K MULT 2 I 30 COMPUTE
C SUB 1 I OFFSET
C MOVEAWRK,I BIN2 TO LIST
C SUB 1 B2 SET OFFSET
C MOVEAWRK,B2 FLD GET STRUCTUR
*-----------
C 5 DO 8 X 30 LOOP THRU DEF
*--------------------------
C X IFEQ 5 IF FLD KEYWRD
C MOVEACL,X C LOAD WORK
C MOVEAFIELD C,15 LOAD DATA
C MOVEAC CL,X SAVE IN WORK
C Z-ADDX LSTX 30 MARK HIGHEST
C MOVE 'N' SKP,X MARK NO SKIP
C END END
*--------------------------
C X IFEQ 6 IF FLD KEYWRD
C OPR IFEQ 'S' IF SUM
C MOVEACL,X C LOAD WORK
C MOVEAC CL,X SAVE IN WORK
C Z-ADDX LSTX MARK HIGHEST
C MOVE 'N' SKP,X MARK NO SKIP
C ELSE ELSE SKIP
C MOVE 'Y' SKP,X MARK SKIP
C OPR IFGE '1' IF SORT
C OPR ANDLE'9' REQUEST
C MOVE OPR S 10 GET ORDER
C MOVE FIELD SRT,S AND SAVE
C END END IF SORT
C END END
C END END IF
*--------------------------
C X IFEQ 7 IF FLD KEYWRD
C SPB IFNE '*'
C MOVEACL,X C LOAD WORK
C MOVEASPB C,15 LOAD DATA
C MOVEAC CL,X SAVE IN WORK
C Z-ADDX LSTX MARK HIGHEST
C MOVE 'N' SKP,X MARK NO SKIP
C ELSE ELSE SKIP
C MOVE 'Y' SKP,X MARK NO SKIP
C END END
C END END
*--------------------------
C X IFEQ 8 IF FLD KEYWRD
C EDIT IFNE '*'
C MOVEACL,X C LOAD WORK
C MOVEAEDIT C,15 LOAD DATA
C MOVEAC CL,X SAVE IN WORK
C Z-ADDX LSTX MARK HIGHEST
C MOVE 'N' SKP,X MARK NO SKIP
C ELSE ELSE SKIP
C MOVE 'Y' SKP,X MARK NO SKIP
C END END
C END END
*--------------------------
C END END 5->8
*--------------------------
C MOVEA'YYY' SKP,9 MARK ALL SKIP
C L# IFEQ 1 IF 1 LABEL
C LB1 IFEQ '*DFT' IF DEFAULT
C Z-ADD0 L# BLANK ALL
C ELSE ELSE
C MOVEACL,9 C LOAD WORK
C MOVEALB1 C,15 LOAD DATA
C MOVEAC CL,9 SAVE IN WORK
C Z-ADD9 LSTX MARK HIGHEST
C MOVE 'N' SKP,9 MARK NO SKIP
C END END
C END END
C L# IFEQ 2 IF 1 LABEL
C MOVEACL,10 C LOAD WORK
C MOVEALB1 C,15 LOAD DATA
C MOVEALB2 C,28 LOAD DATA
C MOVEAC CL,10 SAVE IN WORK
C Z-ADD10 LSTX MARK HIGHEST
C MOVE 'N' SKP,10 MARK NO SKIP
C END END
C L# IFEQ 3 IF 1 LABEL
C MOVEACL,11 C LOAD WORK
C MOVEALB1 C,15 LOAD DATA
C MOVEALB2 C,28 LOAD DATA
C MOVEALB3 C,41 LOAD DATA
C MOVEAC CL,11 SAVE IN WORK
C Z-ADD11 LSTX MARK HIGHEST
C MOVE 'N' SKP,11 MARK NO SKIP
C END END
*---------------------------------------------------------------
C 5 DO LSTX X LOOP THRU FLD
C SKP,X IFEQ 'N' IF NOT SKIP
C MOVEACL,X C LOAD WORK
C X IFEQ LSTX IF LAST PARM
C MOVE ' ' C,55 BLANK +
C END
C ADD 1 SEQ
C EXCPTOUTPUT
C END END IF NOT SKIP
C END END LOOP
*---------------------------------------------------------------
C END END W F#
*---------------------------------------------------------------
C DO 9 X WRITE SORTS
C SRT,X IFNE *BLANKS IF FLD NAME
C MOVEACL,12 C LOAD WORK
C MOVE SRT,X FIELD LOAD TO 10A
C MOVEAFIELD C,15 LOAD DATA
C EXCPTOUTPUT WRITE DEF
C END END NE BLK
C END END DO 9
*
C EXCPTLAST CRT REFMT COPY
C SETON LR
OQCLSRC E OUTPUT
O SEQ 6
O 12 '000000'
O ' HFILE'
O ' FDC '
O C 77
OQCLSRC2 E LAST
O 22 '000001000000 HFILE'
O E LAST
O 22 '000001000000 FDC '
** QRY STATEMENTS
QRYAPP FILE(\\\\\\\\\\.\\\\\\\\\\) TITLE('QRYF PGM GEN')
OUTPUT HEAD('\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\') +
COVER('\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\')
QRYFMT RCDFMT(\\\\\\\\\\)
QRYFLD FIELD(\\\\\\\\\\) +
SUM(*YES) +
SPACE(\) DFTSPC(*NO) +
EDTCDE(\) +
LABEL('\\\\\\\\\\' ' ' ' ')
LABEL('\\\\\\\\\\' '\\\\\\\\\\' ' ')
LABEL('\\\\\\\\\\' '\\\\\\\\\\' '\\\\\\\\\\')
SORT FIELD(\\\\\\\\\\) SUBTOT(*YES)