CDS553

Driver Entries

Last Revised: 03/31/09

CDS553 is used to prompt operator to choose the sequence and range of a multi-keyed file.  The sequence corresponds to the KNUM's.  CDS553 is typically called by reports.  CDS553 will open a channel that the application reads from to obtain the records in the sequence and range selected.  In most cases, CDS553 will open the data file using the SELECT verb.  But if there are multiple KNUM's that are similar, it is possible that the SELECT verb will not use the KNUM based on the operator entries.  In that case CDS553 will use the OPEN verb.

Unlike the previous version of the Driver entry program, CDS003 and CDLIST33/CDS003, CDS553 cannot be called by the menu processor before running the report.  In order to display the selected sequence and range, as well as modify these entries before printing, CDS553 is called by the application program during the other operator entries section.

Calling Format:

CALL "CDS553", ERR=XXXX, Y$, S553$ {, REC$, RECK$ }

All arguments after S553$ are optional.

CDS553 Arguments
ERR=XXXX Branch to XXXX if operator uses F4 to exit, if data file cannot be opened, or if the data dictionary is missing or invalid.
Y$ Standard task control variable.
S553$
S553.CC$ Company Code for Data Dictionary.  Specify only when not using the current company Y.COMPCODE$.
S553.DDFILNAM$ The file name to be used to access the Data Dictionary.  Note that this typically excludes the company code.  Required.
S553.COL
S553.ROW
If passed to CDS553, S553.COL and S553.ROW refer to the column and row on the display where the selected sequence and range should be displayed.  If left as zero, then the selected sequence and range will not be displayed.
S553.CHAN Assigned by CDS553 to the channel that the data file was opened to.  Used by the calling program to read records from the file.
S553.KNO Assigned by CDS553 as the knum used if the data file is opened using OPEN and not SELECT.
S553.SELKNO Assigned by CDS553 as the knum used by SELECT.  If the SELECT verb choose a knum that differs from S553.KNO, then S553.SELKNO is set to -1 and the file is opened using OPEN instead of SELECT.  Note that when the OPEN verb is used, CDS553 will position the file so that the application will read the first record in the range selected.  See examples.
S553.RANGE$
A Operator selected all records within range
S Operator selected a range of records in the file.  CDS553 checks to insure that there are records within the range specified.
S553.FILNAM$ Should be set by the calling program and passed to CDS553 when using the data dictionary from one company, but the data file from another.  If not passed, then CDS553 will assume the data file name to be Y.COMPCODE$+CVS(S553.DDFILNAM$,2).
S553.SEQDISP$ Assigned by CDS553 as the sequence selected by the operator in a display format.  This is the same data displayed @(S553.COL,S553.ROW) if the columns and rows are assigned.
S553.RANGEDISP$ Assigned by CDS553 as the range of records selected by the operator in a display format.  This is the same data displayed @(S553.COL,S553.ROW+1) if the columns and rows are assigned.  Will contain "*** All Records ***" if all records are selected.
S553.DISP$ Assigned by CDS553 as a pipe separated list of fields that make up the selected key.  This is often useful with CDS038 reports where it is desirable that the fields on the left of the report are in the same sequence as the key segments.  S553.DISP$ is often used to build DISP$ to pass to CDS038.
S553.KEYEXP$ Assigned by CDS553 as the key expression.  KEYEXP$ can be used by the calling program to determine the key which may be needed for control break tests, as in K$=SEVAL(S553.KEYEXP$).
Examples:
AP10.VENDNO$+AP10.DATERCV$+AP10.PONO$+AP10.RCTSEQ$
CM01.SLSMANNO$+CM01.ALPHASORT$+CM01.CUSTNO$
IM01.VENDNO$+IM01.PCL$+IM01.RSN$+IM01.ITEMNO$
S553.WHERE$ Assigned by CDS553 as the WHERE clause using REC$ which would be used by the calling program if necessary to re-open the data file using SELECT.  Example: REC.SLSMANNO$>="LEK" and REC.SLSMANNO$<="PLW".  S553.WHERE$ is often used to pass WHERE$ to CDS038.
S553.SORTBY$ Assigned by CDS553 as the SORTBY expression using REC$ which would be used by the calling program if necessary to re-open the data file using SELECT.  Example: REC.SLSMANNO$+REC.ALPHASORT$+REC.CUSTNO$.  S553.SORTBY$ is often used to pass SORTBY$ to CDS038.
S553.LONGSORTBY$ Similar to S553.SORTBY$ except that the complete file name is used.  Example: EXCM01.SLSMANNO$+EXCM01.ALPHASORT$+EXCM01.CUSTNO$
S553.HTAFRK$ Assigned by CDS553 as the starting key of the range selected, converted to hex format using HTA() so that all possible characters may be contained within the starting key.

Typically used to pass KEYBEGIN$ to CDS038 when OPEN is used, i.e., IF S553.SELKNO<0 KEYBEGIN$=ATH(S553.HTAFRK$).

May be needed by calling program if they need to re-process the range of records selected.  It is not necessary to perform a positional read to the file before reading records as CDS553 has already done that.

Example: READ (CHAN,KNUM=S553.KNO,DIR=0,KEY=ATH(S553.HTAFRK$),DOM=NextLine).

S553.HTATOK$ Assigned by CDS553 as the ending range selected.

Typically used to pass KEYEND$ to CDS038 when OPEN is used, i.e., IF S553.SELKNO<0 KEYEND$=ATH(S553.HTATOK$).

See S553.EOF$ below for preferred logic to determine if the application has read past the last record of the selected range.

S553.EOF$ Expression assigned by CDS553 which should be used to determine if you are at the end of the selected range when not using SELECT.  Example: IF S553.SELKNO<0 AND NEVAL(S553.EOF$) THEN GOTO DONE  See complete example below.
REC$ Assigned by CDS553 as the templated string variable to be used when reading records.  Normally the file name less the company code is used as the variable as in CM01$, IM03$, etc.  The application typically reads from the data file using this variable, i.e., READ RECORD(S553.CHAN,END=DONE)CM01$.
RECK$ Assigned by CDS553 as the string used by the KGEN function to describe the files key structure.  Needed when using S553.EOF$ to determine if you are at the end of the range, or when using the KGEN() function to derive the key for removal, etc.

CDS553 is normally called in the section of the program where all other operator entries are made.  CDS553 is designed so that it can be called again using the selected entries as default, should the entries need to be made again.

Example taken from Inventory Evaluation Report, using the Item File where CDS038 is not used, and the program reads the file directly.
0150 CALL "CDS041","CDS553",S553$; REM "Obtain template for CDS553
0160 LET S553.DDFILNAM$="UD20"; REM "Indicate the file name
0170 LET EFFDATE$=STR(Y.JDATE)
0180 DIM PRT$(5,"Y")
0190 CALL "CDS276","Effective Date|Item Sequence|Range|Detail by Receipt|Summary by Item#|Summary by Product Class|Summary by Vendor|Summary by Warehouse|Warehouses|Format",COL; REM "Display the background
0200 LET S553.COL=COL,S553.ROW=3; REM "Assign the col and row for CDS553 to display the sequence & range
0210 REPEAT
0220 CALL "CDS069",0,0,COL,2,"Value Inventory as of this date","D",EFFDATE,
EFFDATE$
0230 CALL "CDS553",ERR=EOJ,Y$,S553$,UD20$,UD20K$
0240 FOR I=1 TO LEN(PRT$)
0250 CALL "CDS069",1,1,COL,I+4,"Print this report (Y/N)","AYN",I,PRT$
0260 NEXT I
0270 CALL "DIS430",Y$,"E"+STR(COL:"00")+"10","",WHSLST$
0280 IF LEN(WHSLST$)=1 THEN LET FMT$="W",DISP$="Q" ELSE LET DISP$=""
0290 CALL "CDS069",1,1,COL,11,"+format option",DISP$+"A{|,2,|,R,,Y}IList
warehouses together by item|WSeparate pages for each warehouse",0,FMT$
0300 LET Z$="Y"; CALL "CDS069",1,1,0,0,"Are entries correct (Y/N)+","AYN",0,Z$
0310 IF CTL=4 THEN GOTO EOJ
0320 UNTIL Z$="Y"
.

.
. Additional logic
.
.
0390 ON S553.RANGE$="R" GOSUB ALL,RANGE; REM "This program uses different logic when all items are selected
.
.
. Additional logic
.

1300 RANGE:
1310 READ RECORD(S553.CHAN,END=1500)UD20$; REM "This channel may be opened by SELECT or OPEN
1320 IF S553.SELKNO<0 AND NEVAL(S553.EOF$) THEN GOTO 1500; REM "This logic is used to determine if you are at the end of the operator specified range when the channel was opened using OPEN
.
.
. Additional logic
.
.
1490 GOTO 1310; REM "Loop to next record
.
.
. Additional logic
.
.

Example using CDS038
0100 REM "PO200 - 12/19/06 Purchase Order Listing
0110 SETESC 8000; SETERR 8000
0120 CALL "CDS276","Sequence|Range|Detail",COL; REM "CDS553 takes two rows, one for Sequence and one for Range
0130 CALL "CDS041","CDS553",S553$; REM "Obtain Template for CDS553
0140 LET S553.DDFILNAM$="PO40",S553.COL=COL,S553.ROW=2; REM "Indicate DD file name and entry column and row
0150 LET DETAIL$="N"
0160 REPEAT
0170 CALL "CDS553",ERR=EOJ,Y$,S553$
0180 CALL "CDS069",1,1,COL,4,"Include line item detail","AYN",0,DETAIL$
0190 LET Z$="Y"; CALL "CDS069",1,1,0,0,"Are entries correct (Y/N)+","AYN",0,Z$
0200 IF CTL=4 THEN GOTO EOJ
0210 UNTIL Z$="Y"
0220 CALL "CDS041","CDS038",S038$
0230 LET S038.PRINTCOUNT$="Y"
0240 LET WHERE$=S553.WHERE$; REM "Pass S553.WHERE$ clause to WHERE$ for use by CDS038
0250 LET SORTBY$=S553.SORTBY$; REM "Pass S553.SORTBY$ clause to SORTBY$ for use by CDS038
0260 IF DETAIL$="Y" THEN LET S038.EXTRTN$="PO201",S038.BLANKS_A=1,S038.COLHEAD$="E"
0270 LET DISP$="PONO|OPEN|WHS|DATEORD|DATEDUE|ALPHASORT|BUYER|REFERENCE|SHIP2NAME|ACKNO|TOTCOST\\\\T"

0280 CALL "CDS038",Y$,Y5$,Y5A$,Y6$,Y6,L,P,S038$,"XXPO40",KNO,KEYBEGIN$,KEYEND$,DISP$,WHERE$,SORTBY$,MODE$,LIMITVAL,SUBHEAD$
0290 GOTO EOJ

8000 REM "Call Error/Escape Routine
8010 CALL "CDS063",STR(TCB(5)),Y$,PGM(-2)
8020 ON Y.ERRSTS GOTO 8030,8040,8050,8060
8030 SETERR 0
8040 RETRY
8050 RETURN
8060 RETRY

9000 EOJ:
9010 IF TCB(13) THEN EXIT
9020 RUN "CDS001"

Example showing all CDS553 fields
4100 REM "CDS553 parameters
4101 PRINT 'CS',
4105 CALL "CDS276","Sequence|Range",COL
4110 CALL "CDS041","CDS553",S553$,"YY"
4120 LET S553.DDFILNAM$="SO40",S553.COL=COL,S553.ROW=2
4130 CALL "CDS553",ERR=EOJ,Y$,S553$,SO40$,SO40K$
4140 CALL "CDS279",S553$
4150 ESCAPE
Data Entry screen
S553$ field values