WORKBENCH
PROGRAMMER PRODUCTIVITY AID
EXPLANATION OF COMMANDS
___________________________________________________________________________________
All commands use column 1 to indicate tags, labels, or comment lines. Commands may not extend beyond column 71 or consist of multiple cards (except those commands denoted with a continuation (-) mark for multiple cards). A period is required to end an "IF" statement set. For readable code, periods are suggested.
KEYWORDS are capital letters
( ) enclose an item that is optional
| | enclose an item that must be specified
* an asterisk in column 1 indicates comment card
bbb a blank card up to column 71 indicates comment card
- continuation mark for "CALL", "ENTRY", STRING, SYNC and UNSTRING" verbs
tag = an 8 character name starting in column 1 to allow controlled branching or
performed routine names. EPILOGUE is a reserved tag for end of job
process. Prior to Workbench's automatic shutdown and stats printing,
EPILOGUE, if specified, will receive control for special user processing
needs.
label= an 8 character field name, which can be referred to in the processing verbs.
field= can either be explicitly defined such as:
(FILE=ddname,POS=nnnnn,LEN=nnnnn,TYPE=x,DEC=nn)
or a literal value surrounded by quotes
or a label name in a DEFINES statement
or the special file control fields (see IF stmt for list)
ddname = "-in" refers to an input file JCL ddname or WORKAREA the 4K scratch
pad storage area.
"-out" refers to an output file JCL ddname
(tag) ADD field (TO) field (.)
(tag) CALL pgmname (USING) field, field, ....field (-) (.)
(tag) COMPARE ddname-in (TO) ddname-in (.)
(tag) COMPRESS ddname-in (TO) ddname-in (.)
(tag) COMPSRC (.)
(tag) CVTBIN field (TO) field (.)
(tag) CVTCHAR field (TO) field (.)
(tag) CVTDEC field (TO) field (.)
(tag) DECODE ddname-in (USING) field (.)
(tag) DECOMPRESS ddname-in (TO) ddname-in (.)
(tag) DEFAREA (SIZE=nnnnn)
(label) DEFINES | label | Label = 8 char name given to "DEFINES"
| literal | Literal = X'....' C'....' P'....'
| explicit| Explicit = (F=ddname,L=nnn,P=nnn,T=a,D=nn)
Type values are C,P,X ; also avail
POS=LOC+/- ; LEN=VAR+/-
(tag) DELETE ddname-in (.)
(tag) DIVIDE field (BY) field REMAINDER field (.)
(label) DLILINK | label | label = 8 char name given
| explicit| explicit = (N=pcbname,L=n,P=n,T=a)
(tag) DUMP ddname-in (.)
(tag) DUMPH ddname-in (.)
(tag) DUMPV ddname-in (.)
(tag) DYNALLOC ddname (USING) field, ...field (-) (.)
(tag) DYNCLOSE ddname (.)
(tag) DYNOPEN ddname (.)
(tag) EDIT field (TO) field (.)
(tag) ENCODE ddname-in (USING) field (.)
(tag) ENTRY DLITCBL (USING) |pcbname | (-)
...../ |pcbname |,$ (.)
(tag) EXHIBIT field (.)
(tag) GOTO |tag | (.)
|EOJ|
(tag) IF |field ||EQUAL (TO) ||field |
|LOC OF ddname ||NOT EQUAL ||LOC OF ddname |
|VAR OF ddname ||LESS THAN ||VAR OF ddname |
|COUNTIN OF ddname ||NOT LESS ||COUNTIN OF ddname |
|COUNTOUT OF ddname ||GREATER THAN ||COUNTOUT OF ddname |
|COUNTDEL OF ddname ||NOT GREATER ||COUNTDEL OF ddname |
|RECORDSW OF ddname || =, NOT = ||RECORDSW OF ddname |
|SCANHIT OF ddname || <, NOT < ||SCANHIT OF ddname |
|MEMNAME OF ddname || >, NOT > ||MEMNAME OF ddname |
|(NOT) NUMERIC |
(tag) IFX see "IF" above
(tag) LOADSRC ddname-in, ddname-in (EXPAND) (SIZE=nnnnn) (.)
(tag) MASKAND field (TO) field (.)
(tag) MASKOR field (TO) field (.)
(tag) MOVE |field | (TO) |field | (.)
|MEMNAME OF ddname| |MEMNAME OF ddname|
(tag) MOVEN field (TO) field (.)
(tag) MOVEX same as "MOVE" above
(tag) MULTIPLY field (BY) field (.)
(tag) PACK field (TO) field (.)
(tag) PERFORM tag (.)
(tag) PRINT ddname-in (.)
(tag) READ ddname-in (.)
(tag) READLIB ddname-in (FOR) |member-name | (CODE=xxx) (.)
| ******** | *=substitute any
(tag) READPAN ddname-in (FOR) |member-name | (.)
| ********** | *=substitute any
(tag) READPDS ddname-in (FOR) |member-name | (.)
| ******** | *=substitute any
(tag) RESTART ddname-in (.)
(tag) RETURN (.)
(tag) SCAN ddname-in (FOR) field (.)
(tag) SCANSTEP ddname-in (FOR) field (.)
(tag) SCANTEST ddname-in (FOR) field (.)
(tag) SPELL ddname-in (.)
(tag) STRING field...field INTO field DELIMITED BY field (-) (.)
(tag) SUBTRACT field (FROM) field (.)
(tag) SYNC field1 ....... field-99 (-) (.)
(tag) UNPACK field (TO) field (.)
(tag) UNSTRING field DELIMITED BY field INTO field....field (-) (.)
(tag) WRITE ddnameout (FROM) ddname-in (.)
(tag) WRITEPDS ddname-out (FROM) ddname-in (.)
(tag) XREF ddname-in (EXPAND) (.)
(tag) XREFDSN ddname-in (.)
DB2 SUPPORTED VERBS
===================
(tag) DB2-CONNECT (SYSTEM=xxxx) (.)
(tag) DB2-DISCONNECT (.)
(tag) EXEC SQL ....(:field) .... END-EXEC (.)
... (:field) .....a END-EXEC8 (.)
":field" is a Workbench variable inside the SQL format
IDMS SUPPORTED VERBS
====================
(tag) ACCEPT field FROM CURRENCY (.)
(tag) ACCEPT field FROM IDMS-STATISTICS (.)
(tag) ACCEPT field FROM SET field CURRENCY (.)
(tag) ACCEPT field FROM AREA field CURRENCY (.)
(tag) ACCEPT field FROM field CURRENCY (.)
(tag) ACCEPT field FROM field NEXT CURRENCY (.)
(tag) ACCEPT field FROM field PRIOR CURRENCY (.)
(tag) ACCEPT field FROM field OWNER CURRENCY (.)
(tag) ACCEPT field FROM field PROCEDURE (.)
(tag) ACCEPT field FROM field BIND (.)
(tag) BIND PROCEDURE FOR field TO field (.)
(tag) BIND RUN-UNIT FOR field DBNAME field (.)
(tag) BIND RUN-UNIT FOR field NODENAME field DBNAME field (.)
(tag) BIND RUN-UNIT FOR field NODENAME field (.)
(tag) BIND RUN-UNIT FOR field
(tag) BIND field TO field (.)
(tag) BIND field WITH field (.)
(tag) COMMIT (ALL) (.)
(tag) ERASE field (PERMANENT MEMBERS) (.)
(tag) ERASE field (SELECTIVE MEMBERS) (.)
(tag) ERASE field (ALL MEMBERS) (.)
(tag) FIND (KEEP) (EXCLUSIVE) (FIRST) field (WITHIN) (AREA) field (.)
(LAST)
(PRIOR)
(NEXT)
(tag) FIND (KEEP) (EXCLUSIVE) (CURRENT) WITHIN (AREA) field (.)
(FIRST)
(LAST)
(NEXT)
(PRIOR)
(OWNER)
(DBKEY)
(DUPLICATE)
(tag) FIND (KEEP) (EXCLUSIVE) field DB-KEY IS field (.)
(tag) FIND (KEEP) (EXCLUSIVE) field WITHIN field CURRENT USING field (.)
(tag) FIND (KEEP) (EXCLUSIVE) field field WITHIN (AREA) field (.)
(tag) FIND (KEEP) (EXCLUSIVE) CALC (ANY) (.)
(tag) FINISH (.)
(tag) GET (field) (.)
(tag) IDMS-CONNECT field (.)
(tag) IDMS-DISCONNECT field (.)
(tag) IDMS-IF (NOT) field (MEMBER) (.)
(IS EMPTY)
(IS NOT EMPTY)
(tag) IDMS-RETURN field FROM field (CURRENCY) (.)
(FIRST)
(LAST)
(NEXT)
(PRIOR)
(USING field)
(tag) KEEP (EXCLUSIVE) (CURRENT) (WITHIN) (AREA) field (.)
(tag) MODIFY field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) FIRST field WITHIN AREA field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) LAST field WITHIN AREA field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) NEXT field WITHIN AREA field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) PRIOR field WITHIN AREA field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) FIRST field WITHIN field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) LAST field WITHIN field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) NEXT field WITHIN field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) PRIOR field WITHIN field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) field DB-KEY IS field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) field WITHIN AREA field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) field WITHIN field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) field WITHIN field CURRENT USING field
(tag) OBTAIN (KEEP) (EXCLUSIVE) field WITHIN field USING field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) field field WITHIN AREA field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) field field WITHIN field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) CALC ANY field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) CALC field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) CURRENT WITHIN AREA field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) FIRST WITHIN AREA field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) LAST WITHIN AREA field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) NEXT WITHIN AREA field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) PRIOR WITHIN AREA field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) DB-KEY field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) DUPLICATE field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) CURRENT WITHIN field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) FIRST WITHIN field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) LAST WITHIN field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) NEXT WITHIN field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) PRIOR WITHIN field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) OWNER WITHIN field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) CURRENT field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) CURRENT (.)
(tag) READY (field) USAGE-MODE IS (EXCLUSIVE) (RETRIEVAL) (.)
(PROTECTED) (UPDATE)
(tag) READY (field) (.)
(tag) ROLLBACK (CONTINUE) (.)
(tag) STORE field (.)
RESERVED VARIABLE LIST
===========================
--EXPLICIT SYNTAX--
FILE 8 character ddname or DEFAREA buffer area.
LEN length keyword in the explicit format.
POS position keyword in the explicit format.
TYPE field format type of character, packed or hex.
DEC decimal places of a numeric field. Used for SQL only.
VAR the adjustable 4 byte binary length value for LEN=VAR.
LOC the adjustable 4 byte binary position value for POS=LOC.
--FILE CONTROL--
COUNTIN records in count for an input file a packed 4 bytes.
COUNTOUT records out count for an output file a packed 4 bytes.
COUNTDEL records deleted count for an input file a packed 4.
MEMNAME READPDS's member name storage an 8 byte field.
RECORDSW eof, rec status indicator (Y=eof, P=present, E=empty).
SCANHIT SCANTEST indicator (Y=hit, space=no hit).
--PROCESS CONTROL--
EOJ reserved tag name which causes task shutdown manually.
EPILOGUE reserved tag name which caused an automatic exit at eof of all files.
IDMS-CTRL the IDMS subschema control area.
IDMS-STATUS a 4 character return code for all operations.
IDMS-DBKEY the 4 byte binary field containing the database key of the record.
IDMS-RECNUM a 4 byte binary field containing the record number.
RETURN-CODE a 4 byte binary field containing the current return code.
SQL-REASON the reason code issued by the call attach facility.
SQLCODE a 4 byte binary field containing the sql return code.
SQLCOUNT a 4 byte binary field containing the rows affected a update/insert/delete request.
PURPOSE: To get IDMS control statistics and db-key.
ENVIRONMENT: IDMS data base manager only.
DESCRIPTION:
(tag) ACCEPT field FROM CURRENCY (.)
(tag) ACCEPT field FROM IDMS-STATISTICS (.)
(tag) ACCEPT field FROM SET field CURRENCY (.)
(tag) ACCEPT field FROM AREA field CURRENCY (.)
(tag) ACCEPT field FROM field CURRENCY (.)
(tag) ACCEPT field FROM field NEXT CURRENCY (.)
(tag) ACCEPT field FROM field PRIOR CURRENCY (.)
(tag) ACCEPT field FROM field OWNER CURRENCY (.)
(tag) ACCEPT field FROM field PROCEDURE (.)
(tag) ACCEPT field FROM field BIND (.)
SPECIAL NOTES:
The ACCEPT verb is used to get db-key or stats information. IDMS-STATUS and IDMS-CNTL are available through direct Workbench reference. See reserved variable list page C-9.
"tag" a name up to 8 characters for GOTO branching.
"field" is either a label reference to a DEFINES statement, a data value constant, or the explicit
usage of file, length, and position info (see DEFINES).
" . " will delimit an IF statement set.
SAMPLE: col 1 .....up to col 71
*****************************************************
* idms area sweep to get db-keys *
*****************************************************
umtcxfr DEFAREA SIZE=220 *memory workare
dbstats DEFAREA SIZE=300 *memory workarea
rec1workDEFINES (F=umtcxfr,P=1,L=220) *full work size
dbstat1 DEFINES (F=dbstats,P=1,L=300) *stats layout
db1name DEFINES 'dev5dict ' *db names must be 16 bytes
ss1name DEFINES 'intssc01 ' *schema name must be 16 bytes
rc1name DEFINES 'umtcxfr ' *record name - 16 bytes
start BIND RUN-UNIT FOR ss1name DBNAME db1name.*bind run unit
BIND rc1name TO rc1work. *declare rec to storage
READY ar1name. *retrieval mode
OBTAIN FIRST rc1name WITHIN AREA ar1name.*area sweep 1st rec
IF IDMS-STATUS NOT = '0000' *if read failed
EXHIBIT IDMS-STATUS * yes-display
GOTO done. * -exit
ACCEPT dbstat1 FROM IDMS-STATISTICS. *get stats
PRINT dbstat. *and print them
done FINISH. *terminate DBMS
GOTO EOJ. *shutdown
PURPOSE: To accumulate values into a field.
DESCRIPTION:
(tag) ADD field (TO) field (.)
SPECIAL NOTES:
ADD will add the value in the first operand to the value of the second operand. Field type is checked and automatically converted to the receiving field's numeric type.
Numeric types are character display, packed decimal, and binary. Character types have maximum size of 31 bytes, Packed fields have limits of 31 digits (16 bytes), and binary fields have limits of 4 bytes binary. Max binary numeric value is 134,217,727 or hex '07FFFFFF'. If neither field is binary, the limit is 3115 digits.
Numeric validity checking is done prior to function. An error message will print and the activity will be skipped for data values that are not numeric. Warning messages will print for overflow in excess of 31 digits. User fields, however, will truncate to its defined size.
EPILOGUE is a reserved tag to instruct Workbench to automatically branch and process starting at this tag. Using EPILOGUE requires the use of GOTO EOJ to terminate the task.
"tag" a name up to 8 characters for GOTO branching and is optional..
"field" is either a label reference to a DEFINES statement, a data value constant, or the
explicit usage of file, length, and position info (see DEFINES).
" . " will delimit an IF statement set and is optional.
SAMPLE: column 1 .......up to col 71
*************************************
* read and accum billed amounts *
*************************************
billed DEFINES (F=mstdd,P=1,L=4,T=X) *amt field
total DEFINES (F=WORKAREA,P=1,L=16,T=P) *total 31 digit size
CVTDEC '0' to total. *init the work to zero
start READ mstdd. *read next mst
ADD billed TO total. *accum amount
GOTO start. *loop until done
EPILOGUE EXHIBIT total *at eof display
GOTO EOJ. *shutdown
PURPOSE: To designate database and record working storage required by the IDMS task.
ENVIRONMENT: IDMS data base manager only.
DESCRIPTION:
Format 1:
(tag) BIND PROCEDURE FOR field TO field (.)
Format 2:
(tag) BIND RUN-UNIT FOR field DBNAME field (.)
(tag) BIND RUN-UNIT FOR field NODENAME field DBNAME field (.)
(tag) BIND RUN-UNIT FOR field NODENAME field (.)
(tag) BIND RUN-UNIT FOR field
Format 3:
(tag) BIND field TO field (.)
(tag) BIND field WITH field (.)
SPECIAL NOTES:
The format 2 BIND establishes connection to IDMS for the DML subschema you have chosen. Format 3 is used to instruct IDMS where to store the retreived record.
"tag" a name up to 8 characters for GOTO branching.
"field" is either a label reference to a DEFINES statement, a data value constant, or the explicit
usage of file, length, and position info (see DEFINES).
" . " will delimit an IF statement set.
SAMPLE: col 1 .....up to col 71
*****************************************************
* idms area sweep to dump out records *
*****************************************************
umtcxfr DEFAREA SIZE=220 *memory workarea
rec1work DEFINES (F=umtcxfr,P=1,L=220) *full work size
db1name DEFINES 'dev5dict ' *db names must be 16 bytes
ss1name DEFINES 'intssc01 ' *schema name must be 16 bytes
rc1name DEFINES 'umtcxfr ' *record name - 16 bytes
ar1name DEFINES 'pend-area ' *area name - 16 bytes
start BIND RUN-UNIT FOR ss1name DBNAME db1name.*bind run unit
BIND rc1name TO rc1work. *declare rec to storage
READY ar1name USAGE-MODE IS RETRIEVAL. *read only mode
OBTAIN FIRST rc1name WITHIN AREA ar1name.*area sweep 1st rec
loop IF IDMS-STATUS NOT = '0000' *if read failed
EXHIBIT IDMS-STATUS * yes-display
GOTO done. * -exit
ADD '1' TO COUNTIN OF umtcxfr. *manually up counts
PRINT umtcxfr. *print record
DUMP umtcxfr. *dump record
OBTAIN NEXT rc1name WITHIN AREA ar1name. *read next record
GOTO loop. *loop for more
done FINISH. *terminate DBMS
EXHIBIT '---total records---'. *display counts
EXHIBIT COUNTIN OF umtcxfr. *
GOTO EOJ. *shutdown
PURPOSE: To call a user module and pass requested data fields.
DESCRIPTION:
(tag) CALL Pgmname (USING) field, field,.... field (-) (.)
SPECIAL NOTES:
CALL loads the named user written module and passes control. The pgmname does not have quotes around it. Up to 100 data fields in a parm string may be passed. Normal COBOL linkage conventions are observed where register 1 contains the address of the parm list. The parm list contains an address for every data field requested. The last data field address contains hex "80" to signify the parm list end. Note: NOENDJOB and NORENT compile options may be needed for calls to COBOL/VS programs. For COBOL 2, use DATA(24) compile and AMODE=24 for the link options to force 24 bit mode of COBOL .
Data modifications done by user modules do affect the actual storage locations. The reserved variable RETURN-CODE is available to test register 15 upon return to Workbench. Register 15 is the same as COBOL's RETURN-CODE.
"tag" is a name up to 8 char used for "GOTO" branching.
"pgmname" is the module to receive control (no quotes).
"field" is either a label reference to a DEFINES statement, a data value constant, or the
explicit usage of file, length, and position info (see DEFINES).
" - " used to allow multiple cards.
" . " will delimit an IF statement set.
SAMPLE: col 1 .......up to col 71
*************************************
* read and accum amts via ADJ010 *
*************************************
billed DEFINES (F=mstdd,L=4,P=23,T=P) *billed amount
total DEFINES (F=WORKAREA,L=6,T=C) *total amount
percnt DEFINES (F=WORKAREA,L=3,P=10) *percent calc
start READ mstdd. *read next mst
CALL adj010 USING billed - *call calc pgm
total - *
percnt. *
IF RETURN-CODE = '0' *if good return code
GOTO start. * yes-loop until done
EXHIBIT 'aborting......' *display abort msg
EXHIBIT RETURN-CODE. *display code
GOTO EOJ. *shutdown
AND
STATEMENT COMMENTS
PURPOSE: To provide documentation.
DESCRIPTION:
(1). * - Asterisk in column 1 up to column 71.
(2). bbb - Completely blank card up to column 71.
(3). - Comments can be placed one space beyond the required syntax.
(4). - Comments may be placed after the required syntax. For readability we
suggest an asterisk before the comments although the asterisk does not
mean anything to Workbench except in column 1.
SPECIAL NOTES:
Good programming practice suggest comments even for quick prints. Comments are easy to use and do not cause processing overhead.
SAMPLE: col 1 .......up to col 71
*************************************
* work labels master # location *
*************************************
mstnum DEFINES (F=mstdd,P=1,L=10)
*stnum DEFINES (F=mstdd,P=5,L=25) *commented out
*************************************
* read, select, print the record *
*************************************
start READ mstdd. *read new mst
IF mstnum = '1234567890' *find it?
PRINT mstdd. *yes, print it
GOTO start. *loop for more
PURPOSE: To physically commit database records and release locks.
ENVIRONMENT: IDMS data base manager only.
DESCRIPTION:
(tag) COMMIT (ALL) (.)
SPECIAL NOTES:
Database records deleted are not physically removed until a FINISH or COMMIT is issued.
"tag" a name up to 8 characters for GOTO branching.
" . " will delimit an IF statement set.
SAMPLE: col 1 .....up to col 71
*****************************************************
* idms area sweep to delete records *
*****************************************************
umtcxfr DEFAREA SIZE=220 *memory workarea
rec1work DEFINES (F=umtcxfr,P=1,L=220) *full work size
acct DEFINES (F=umtcxfr,P=7,L=5) *account id
db1name DEFINES 'dev5dict ' *db names must be 16 bytes
ss1name DEFINES 'intssc01 ' *schema name must be 16 bytes
rc1name DEFINES 'umtcxfr ' *record name - 16 bytes
ar1name DEFINES 'pend-area ' *area name - 16 bytes
start BIND RUN-UNIT FOR ss1name DBNAME db1name.*bind run unit
BIND rc1name TO rc1work. *declare rec to storage
READY ar1name USAGE-MODE IS UPDATE. *update mode
OBTAIN FIRST rc1name WITHIN AREA ar1name.*area sweep 1st rec
loop IF IDMS-STATUS NOT = '0000' *if read failed
EXHIBIT IDMS-STATUS * yes-display
GOTO done. * -exit
IF acct = 'AU123' *if account found
PRINT umtcxfr * yes-print record
ERASE rc1name * -delete the record
IF IDMS-STATUS NOT = '0000' * -test if ok
EXHIBIT IDMS-STATUS * -display error
ROLLBACK * -rollback update
GOTO done. * -exit
IF acct = 'AU123' *if account found
COMMIT. * yes-commit it
ADD '1' TO COUNTIN OF umtcxfr. *manually up counts
OBTAIN NEXT rc1name WITHIN AREA ar1name. *read next record
GOTO loop. *loop for more
done FINISH. *terminate DBMS
EXHIBIT '---total records---'. *display counts
EXHIBIT COUNTIN OF umtcxfr. *
GOTO EOJ. *shutdown
PURPOSE: To print vertical record dumps when the two given records are different.
DESCRIPTION:
(tag) COMPARE ddname-in (TO) ddname-in (.)
SPECIAL NOTES:
The symbol "=" prints below bytes that are equal and the symbol "*" prints below bytes that are different.
Only those records that are different will print. For unequal record sizes place the larger sized records on ddnameB for better documentation of the differences. The Compare command initiates a report for the output prints. Data set name, volume serial number, create date, and other report title information are automatically printed.
Trick: On files that always have data changes (such as date processed), blank out the field on both files before compare. See Lesson #9 and sample #37 for more details.
Trick: On files of unequal lengths or when only portions of the file are to be compared, build a temporary extract in a DEFAREA and compare the work areas. Don't forget to set the DEFAREA's COUNTIN field so the record counts have meaning.
"tag" is a name up to 8 characters for GOTO branching.
"ddname-in" is the 1st input file name.
"ddname-in" is the 2nd input file name.
" . " will delimit an IF statement set.
SAMPLE: col 1 .......up to col 71
*************************************
* keys and limit defined *
*************************************
mst#a DEFINES (F=mst1a,L=5,P=5) *rec location
mst#b DEFINES (F=mst2b,L=5,P=5) *rec location
*************************************
* report test runs a & b masters *
*************************************
start SYNC mst#a mst#b. *sync equal keys
COMPARE mst1a TO mst2b. *print update
GOTO start. *loop until done
PURPOSE: To squeeze duplicated bytes in order to save storage.
DESCRIPTION: (tag) COMPRESS ddname-in (TO) ddname-in (.)
SPECIAL NOTES:
The input file record may be either fixed or variable format, but the output record created is in variable format. One logical record in will match on logical record out of this process. The difference is that the record will be compressed.
The RDW for the new output record will automatically be set and ready for outputting. You must specify an LRECL of 5 bytes greater than the original record size.
The compressing routine used bytes 1-4 of the receiving ddname for the RDW. Byte 5 is reserved for the compress control flag. Whenever four or more bytes are found to be the same, the first byte is marked with the control flag, the second is the repeating length size, and the third is the byte value which repeats. Sometimes an individual record cannot reduced and it is for this reason the LRECL must be 5 bytes larger than the original.
There are several advantages to keeping a one-to-one match between original compressed records. These include the ability to divide compressed files, scan, search, or modify these records quicker. Records can be stored in a compressed format, yet when needed, they can selectively be decompressed.
"tag" is a name up to 8 characters for GOTO branching.
"ddname-in" is the file record to compress..
"ddname-in" is where to build the new output record.
" . " will delimit an IF statement set.
SAMPLE: col 1 .......up to col 71
****************************************
* compress master file to backup *
****************************************
start READ mstin. *read in file
COMPRESS mstin TO WORKAREA. *squeeze record
WRITE mstout FROM WORKAREA. *out compressed rec
GOTO start. *loop until done
PURPOSE: To request a source code compare.
DESCRIPTION:
(tag) COMPSRC (.)
SPECIAL NOTES:
COMPSRC is used to activate the source code compare facility. Issuing a COMPSRC causes the "before" source statements to be compared against the "after" statements using a page split technique on the loaded compare tables (see LOADSRC). Maximum record length is 80 bytes.
The "after" table is first compared as an entire group against the "before" table. If the page fails to match, the "after" page is split and compares are done against the smaller pages. When a page matches a "before" table section, both "after" and "before" pages are set as used. This process of comparing and page splits continue until all statements are accounted for or determined to be different. Page split id numbers appear on the compare R06 report as well as the record number that matched.
This approach allows major blocks of source code to be identified first, then the smaller blocks. Finally the page size will be a single statement. By using this technique, we can locate and identify blocks of code that moved but did not change. The "SEQ SKIP" message identifies moved blocks.
Report R06 prints the "before" source code showing the DELETED, EQUAL, or SEQ SKIP source lines. ADDs from "after" source code appear at the end of this compare. Detail lines print file ddname, record number, page split id, and the standard heading information.
"tag" a name up to 8 characters for GOTO branching.
" . " will delimit an IF statement set.
This sample is a simplified library compare which assumes equal records and equal members on both files. Sample is for logical illustration.
SAMPLE 1: col 1 .......up to col 71
************************************
* simplified library source compare*
************************************
hold DEFINES C'AAAAAAAA' *hold member
reads READPDS before FOR FT****** *assumes equal
READPDS after FOR FT****** *rec & mem cnt
IF MEMNAME OF before = hold
LOADSRC before after
MOVE MEMNAME OF before TO hold
GOTO reads.
COMPSRC.
MOVE MEMNAME OF before TO hold.
LOASSRC before after.
GOTO reads.
This next sample is a comprehensive library compare which will coordinate members and indicate members added or removed.
SAMPLE 2: col 1 .......up to col 71
*************************************
* comprehensive library compare *
*************************************
hold DEFINES C'AAAAAAAA' *hold member
high DEFINES C'ZZZZZZZZ' *high member
seqb DEFINES (F=before,P=72,L=9) *seq num
seqa DEFINES (F=after,P=72,L=9) *seq num
hldid DEFINES C'Y' *hold indicator
READPDS before FOR ******** *init reads
READPDS after FOR ******** *
GOTO reset. *
loop IF RECORDSW OF before = 'Y' *if eof set high
MOVE high TO MEMNAME OF before. *
IF RECORDSW OF after = 'Y' *
MOVE high TO MEMNAME OF after. *
IF MEMNAME OF before = MEMNAME OF after
IF MEMNAME OF before = hold *
MOVE ' ' TO seqb *if same member
MOVE ' ' TO seqa * then clear seq
LOADSRC before after * load and read
READPDS before FOR ******** * next records
READPDS after FOR ******** *
GOTO loop. *
IF MEMNAME OF before > hold *if member done
IF MEMNAME OF after > hold * then request
COMPSRC * a compare
GOTO reset. * and reset hold
IF MEMNAME OF before = hold *if before not
GOTO loadb. * done finish it
IF MEMNAME OF after = hold *if after not
GOTO loada. * done finish it
GOTO loop. *
loadb MOVE RECORDSW OF after to hldid *save file ind
loadbl IF MEMNAME OF before = hold *
MOVE 'E' TO RECORDSW OF after *finish up before
MOVE ' ' TO seqb * member loading
LOADSRC before after * before reqst
MOVE hldid TO RECORDSW OF after *reset file ind
READPDS before FOR ******** * compare
GOTO loadb. * and reset
COMPSRC. *
GOTO reset. *
loada MOVE RECORDSW OF after to hldid *save file ind
loadal IF MEMNAME OF after = hold *finish after
MOVE 'E' TO RECORDSW OF after *switch set empty
MOVE ' ' TO seqa *or deleted to
LOADSRC before after *avoid before rec
MOVE hldid TO RECORDSW OF after *reset file ind
READPDS after FOR ******** *being loaded
GOTO loada. *too early
COMPSRC. *
GOTO reset. *
reset IF MEMNAME OF before = MEMNAME OF after
MOVE MEMNAME OF before TO hold.
IF MEMNAME OF before < MEMNAME OF after
MOVE MEMNAME OF before TO hold.
IF MEMNAME OF before > MEMNAME OF after
MOVE MEMNAME OF after TO hold.
GOTO loop.
PURPOSE: To convert a display or packed numeric field into a binary format. This verb is
preferred over the MOVE statement for numeric moves.
DESCRIPTION:
(tag) CVTBIN field (TO) field (.)
SPECIAL NOTES:
CVTBIN converts the value of a field to a binary format and stores the value in another location. The sending field may be either a character display or a packed numeric data. The receiving field has a size maximum of 4 bytes.
Definition of field type is determined by the TYPE keyword or the literal defined. See DEFINES verb for more information.
The receiving field will be padded with zeros or truncated of high order digits when necessary to handle the sending field being too small or too large.
"tag" a name up to 8 characters for GOTO branching.
"field" is either a label reference to a DEFINES statement, a data value constant, or the explicit
usage of file, length, and position info (see DEFINES).
" . " will delimit an IF statement set.
SAMPLE: col 1 .......up to col 71
*************************************
* convert fields into binary *
*************************************
lit54 DEFINES P'+54' *packed value
amount DEFINES (F=in,P=1,L=12,T=C) *amount field
time DEFINES (F=in,P=45,L=6,T=P) *time
rdw DEFINES (F=WORKAREA,P=1,L=2,T=X)
amt DEFINES (F=WORKAREA,P=5,L=4,T=X)
tim DEFINES (F=WORKAREA,P=9,L=3,T=X)
start READ in. *read rec
CVTBIN lit54 TO rdw. *load vb length
CVTBIN amount TO amt. *amt convert
CVTBIN time TO tim. *time convert
WRITE out FROM WORKAREA. *output rec
GOTO EOJ. *shut down
PURPOSE: To convert a binary or packed numeric field into a character format. This verb
is preferred over the MOVE verb for numeric fields because of its automatic
justification features.
DESCRIPTION:
(tag) CVTCHAR field (TO) field (.)
SPECIAL NOTES:
CVTCHAR converts a numeric field into character format. The sending field may be either a packed numeric or binary data. The field's maximum size is 31 digits (16 bytes including the sign).
Definition of field type is determined by the TYPE keyword or the literal defined. See DEFINES verb for more information.
The receiving field will be padded with zeros or truncated of high order digits when necessary to handle the sending field being too small or too large.
"tag" a name up to 8 characters for GOTO branching.
"field" is either a label reference to a DEFINES statement, a data value constant, or the explicit
usage of file, length, and position info (see DEFINES).
" . " will delimit an IF statement set.
SAMPLE: col 1 .......up to col 71
*************************************
* convert fields into character *
*************************************
lit54 DEFINES P'+54' *packed value
amount DEFINES (F=in,P=1,L=12,T=C) *amount field
start READ in. *read rec
CVTCHAR LIT54 TO amount. *convert value
WRITE out FROM in. *output rec
GOTO EOJ. *shut down
PURPOSE: To convert a binary or display numeric field into a packed format.
DESCRIPTION:
(tag) CVTDEC field (TO) field (.)
SPECIAL NOTES:
CVTDEC converts the value of a field into a packed format and stores the value at another location. The sending field may be either a character display numeric or binary data. The sending field's maximum size is 15 digits (8 bytes including the sign).
Definition of field type is determined by the TYPE keyword or the literal defined. See DEFINES verb for more information.
The receiving field will be padded with zeros or truncated of high order digits when necessary to handle the sending field being too small or too large.
"tag" a name up to 8 characters for GOTO branching.
"field" is either a label reference to a DEFINES statement, a data value constant, or the explicit
usage of file, length, and position info (see DEFINES).
" . " will delimit an IF statement set.
SAMPLE: col 1 .......up to col 71
*************************************
* convert fields into packed *
*************************************
lit54 DEFINES P'+54' *packed value
amount DEFINES (F=in,P=1,L=12,T=C) *amount field
time DEFINES (F=in,P=45,L=4,T=X) *time
rdw DEFINES (F=WORKAREA,P=1,L=2,T=X)
amt DEFINES (F=WORKAREA,P=5,L=8,T=P)
tim DEFINES (F=WORKAREA,P=15,L=3,T=P)
start READ in. *read rec
CVTBIN lit54 TO rdw. *load vb length
CVTDEC amount TO amt. *amt convert
CVTDEC time TO tim. *time convert
WRITE out FROM WORKAREA. *output rec
GOTO EOJ. *shut down
PURPOSE: To connect to IBM's DB2 database environment.
ENVIRONMENT: DB2 data base manager only.
DESCRIPTION:
(tag) DB2-CONNECT (SYSTEM=xxxx) (PUNCH=LOADER) (.)
(PUNCH=BENCH)
SPECIAL NOTES:
DB2-CONNECT instructs Workbench to connect the task to DB2 via the Call Attach Facility (CAF) under Workbench's own plan name BENCH19. See DB2-DISCONNECT for releasing the resources.
The PUNCH parameter builds and writes to ddname BENPUNCH the IBM loader command cards based on the select or declared cursors that exist in the job. Using the PUNCH=BENCH, builds Workbench DEFINES statements instead of IBM loader statements.
DB2-CONNECT instructs Workbench to connect the task to DB2. For shops that have IDMS, IMS, and/or DB2, connection to these facilities can be made at the same time. Transfer of data from one DBMS to another is allowed provided the CPU region supports the products.
"tag" a tag name up to 8 characters used for GOTO branching.
"SYSTEM" keyword for DB system id. Max 4 characters.
SAMPLE: col 1 .....up to col 71
*****************************************************
* db2 record dump *
*****************************************************
account DEFAREA SIZE=220 *memory workarea
rec1work DEFINES (F=account,P=1,L=220) *full work size
acctid DEFINES (F=account,P=1,L=5) *acct id
acctname DEFINES (F=account,P=6,L=40) *acct name
acctbal DEFINES (F=account,P=46,L=8,T=P) *acct amount
date DEFINES '05/12/1990' *search date
DB2-CONNECT SYSTEM=DB2T. *connect to db2
IF SQLCODE NOT = '0' *
EXHIBIT 'aborting....' *if connect error
EXHIBIT SQL-REASON * yes-issue msg
GOTO EOJ. *
* *declare cursor
EXEC SQL DECLARE cur1 CURSOR
SELECT account_id, account_name, beg_balance
FROM db2.paxkact
WHERE CHAR(account_date,USA) = :date END-EXEC.
* *open cursor
EXEC SQL OPEN cur1 END-EXEC.
* *read first row
loop EXEC SQL FETCH cur1
INTO :acctid, :acctname, :acctbal END-EXEC.
IF SQLCODE NOT = '0' *if read failed
EXHIBIT SQLCODE * yes-display
GOTO done. * -exit
ADD '1' TO COUNTIN OF account. *manually up counts
PRINT account. *print record
DUMP account. *dump record
GOTO loop. *loop for more
done EXEC SQL CLOSE cur1 END-EXEC. *close cursor
DB2-DISCONNECT. *terminate DBMS
EXHIBIT '---total records---'. *display counts
EXHIBIT COUNTIN OF account. *
GOTO EOJ. *shutdown
PURPOSE: To disconnect from IBM's DB2 database environment.
ENVIRONMENT: DB2 data base manager only.
DESCRIPTION:
(tag) DB2-DISCONNECT (.)
SPECIAL NOTES:
DB2-DISCONNECT instructs Workbench to close and release the DB2 task resources. Workbench manages resource usage via the Call Attach Facility (CAF) under Workbench's own plan name BENCH19. See DB2-CONNECT for allocation of DB2 resources.
"tag" a tag name up to 8 characters used for GOTO branching.
SAMPLE: col 1 .....up to col 71
*****************************************************
* db2 record dump *
*****************************************************
account DEFAREA SIZE=220 *memory workarea
rec1work DEFINES (F=account,P=1,L=220) *full work size
acctid DEFINES (F=account,P=1,L=5) *acct id
acctname DEFINES (F=account,P=6,L=40) *acct name
acctbal DEFINES (F=account,P=46,L=8,T=P) *acct amount
date DEFINES '05/12/1990' *search date
DB2-CONNECT SYSTEM=DB2T. *connect to db2
* *declare cursor
EXEC SQL DECLARE cur1 CURSOR
SELECT account_id, account_name, beg_balance
FROM db2.paxkact
WHERE CHAR(account_date,USA) = :date END-EXEC.
* *open cursor
EXEC SQL OPEN cur1 END-EXEC.
* *read first row
loop EXEC SQL FETCH cur1
INTO :acctid, :acctname, :acctbal END-EXEC.
IF SQLCODE NOT = '0' *if read failed
EXHIBIT SQLCODE * yes-display
GOTO done. * -exit
ADD '1' TO COUNTIN OF account. *manually up counts
PRINT account. *print record
DUMP account. *dump record
GOTO loop. *loop for more
done EXEC SQL CLOSE cur1 END-EXEC. *close cursor
DB2-DISCONNECT. *terminate DBMS
EXHIBIT '---total records---'. *display counts
EXHIBIT COUNTIN OF account. *
GOTO EOJ. *shutdown
PURPOSE: To restore data that was encrypted using the ENCODE facility.
DESCRIPTION:
(tag) DECODE ddname-in (USING) field (.)
SPECIAL NOTES:
DECODE is the opposite of ENCODE. Therefore, the same encryption key and technique must be used. See the ENCODE for special notes. Password must be 8 bytes in length.
SAMPLE: col 1 .......up to col 71
*************************************
* convert fields into packed *
*************************************
password DEFINES 'TENNIS ' *encryption key
loop READPDS textin FOR admin*** *read members
DECODE textin USING password. *decode rec
WRITEPDS textout FROM textin. *rewrite mem
GOTO loop.
PURPOSE: To unsqueeze a compress file to its original format.
DESCRIPTION:
(tag) DECOMPRESS ddname-in (TO) ddname-in (.)
SPECIAL NOTES:
The input file record must be a compressed format which contains special control flags and markings (See COMPRESS verb).
The decompressing routine uses bytes 1-4 of the receiving ddname for the RDW. Byte 5 determines the decompress control flag. Whenever a control flag is found, the next byte indicates the number of times to duplicate the value in the third byte. The original record area is left intact. It is the receiving area that will contain the expanded record.
"tag" is a name up to 8 characters for GOTO branching.
"ddname-in" is the file record to decompress.
"ddname-in" is where to build the new output record.
" . " will delimit an IF statement set.
SAMPLE: col 1 .......up to col 71
******************************************
*decompress master file *
******************************************
start READ mstbk. *read in file
DECOMPRESS mstbk TO WORKAREA. *unsqueeze record
WRITE mstout FROM WORKAREA. *out original rec
GOTO start. *loop until done
PURPOSE: To define a scratch pad area in memory similar to WORKAREA.
DESCRIPTION: tag DEFAREA (SIZE=nnnnn)
SPECIAL NOTES:
DEFAREA was created to allow workareas of variable sizes. The tag name used is treated the same as a file ddname for field references and record print verbs. Maximum size is 32760 bytes and minimum is 1 byte. A DEFAREA ddname counts as one of your 99 in/out file ddnames allowed.
Because the DEFAREA tag is considered a file name, the PRINT, COMPARE, and other verbs using file name are supported. In earlier versions of WORKBENCH (V2.xx-4.xx), we had to "read in" a record from a file and steal it's buffer area for record building.
The reserved name WORKAREA continues to be automatically built with the 4096 byte size. DEFAREA does not need to be stated for the system scratch pad name WORKAREA.
"tag" a work space name up to 8 characters is required.
"SIZE" keyword is the memory size in bytes that you wish to allocate. If not stated the default is
4096 bytes.
SAMPLE: col 1 .....up to col 71
*****************************************************
* idms area sweep to dump out records *
*****************************************************
umtcxfr DEFAREA SIZE=220 *memory workarea
rec1work DEFINES (F=umtcxfr,P=1,L=220) *full work size
db1name DEFINES 'dev5dict ' *db name
ss1name DEFINES 'intssc01 ' *schema name
rc1name DEFINES 'umtcxfr ' *record name
ar1name DEFINES 'pend-area ' *area name
start BIND RUN-UNIT FOR ss1name DBNAME db1name. *bind run unit
BIND rc1name TO rc1work. *declare rec to storage
READY ar1name USAGE-MODE IS RETRIEVAL. *read only mode
OBTAIN FIRST rc1name WITHIN AREA ar1name. *area sweep 1st rec
loop IF IDMS-STATUS NOT = '0000' *if read failed
EXHIBIT IDMS-STATUS * yes-display
GOTO done. * -exit
ADD '1' TO COUNTIN OF umtcxfr. *manually up counts
PRINT umtcxfr. *print record
DUMP umtcxfr. *dump record
OBTAIN NEXT rc1name WITHIN AREA ar1name. *read next record
GOTO loop. *loop for more
done FINISH. *terminate DBMS
EXHIBIT '---total records---'. *display counts
EXHIBIT COUNTIN OF umtcxfr. *
GOTO EOJ. *shutdown
PURPOSE: To provide labels for file or WORKAREA data fields. To define a data key for the
SYNC verb. To provide equates to other labels.
DESCRIPTION:
(label) DEFINES label
literal
explicit
SPECIAL NOTES:
"label" is a name up to 8 characters
"literal" has five formats:
'character data inside single quotes or double quotes'
"A double quote allows works like it's
C'character data inside single or double quotes'
P'packed data up to 31 digits + or - '
X'hex data in even increments '
"explicit" defines a field within an input file or WORKAREA by providing the ddname-in, the
POSition within the record (based on the first byte equal to 1), the LENgth, and Type
of the field. Each are separated by commas and enclosed with the parentheses ( ) but
may be in any sequence. POSition and LENgth are limited to 32760 bytes.
"explicit" has four operands. Only FILE is required.
"FILE=" or "F=" denotes the input file name or the WORKAREA. No default.
"POS=" or "P=" denotes the starting position of the field. Defaults to 1.
"LEN=" or "L=" denotes the length in bytes of the operand. Defaults to 1.
"TYPE=" or "T=" field type C=char, P=packed, X=hex binary. Default is "C".
A special feature of the POSition operand is the LOCation reference. "LOC" means
location pointer as set by the SCANTEST verb (see SCANTEST). You can also
modify the length fields and make them variable by specifying LEN=VAR.
Modification is done by the ADD/MOVE verbs.
Formats: (FILE=WORKAREA,POS=nnnnn,LEN=nnnnn,TYPE=a) or
(FILE=ddname-in,POS=nnnnn,LEN=nnnnn,TYPE=a) or
(FILE=ddname-in,POS=LOC,LEN=VAR,TYPE=a) or
(FILE=ddname-in,POS=LOC+nnnnn,LEN=nnnnn,TYPE=a) or
(FILE=ddname-in,POS=LOC-nnnnn,LEN=nnnnn,TYPE=a)
SAMPLE: col 1 .......up to col 71
*************************************
* work labels *
*************************************
total DEFINES (F=WORKAREA,P=1,L=8,T=P)
rdwlen DEFINES (F=bill,P=1,L=2,T=X)
scan+2 DEFINES (F=mstdd,L=3,P=LOC+2)
msthold DEFINES (F=WORKAREA,L=VAR,P=1)
mstnum DEFINES (F=mstdd,P=1,L=10)
cotitle DEFINES (FILE=mstdd,POS=10,LEN=15)
sel-it DEFINES C'1234567890'
title DEFINES "WORKBENCH'S DOUBLE QUOTE"
company DEFINES 'XYZ CORPORATION'
data DEFINES C'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
packnum DEFINES P'+1234567890123456789012345678901'
packa DEFINES P'-12456789'
packb DEFINES P'123'
hex DEFINES X'5B00F2FF'
*************************************
* read, select, modify the record *
*************************************
start READ mstdd. *read next mst
ADD '1' TO VAR OF mstdd. *up fld length
ADD '1' TO LOC OF mstdd. *up pos loc
IF mstnum = sel-it *find it?
MOVE company TO cotitle *move in new name
WRITE mstout FROM mstdd. *yes, write it
GOTO start. *loop for more
PURPOSE: To mark a record as deleted so that subsequent processing statements using that record
are skipped until a new read has occurred.
DESCRIPTION:
(tag) DELETE ddname-in (.)
SPECIAL NOTES:
DELETE command takes advantage of the conditional processing each command has built in. When a record is not available, has been deleted, or is not present, commands will bypass the process request until a new read has been issued for that file.
"tag" is a name up to 8 characters used for GOTO branching.
"ddname" is the input file of the record to mark as deleted.
" . " will delimit an IF statement set.
SAMPLE: col 1 .......up to col 71
*************************************
* number defined *
*************************************
mstnum DEFINES (F=mstdd,L=5,P=5) *rec location
*************************************
* copy all but 12345 *
*************************************
start READ mstdd. *read next master
IF mstnum EQUAL '12345' *if rec
DELETE mstdd. * skip it
WRITE outmst from mstdd. *write record but
GOTO start. *not rec 12345
PURPOSE: To mathmatically divide one number by another.
DESCRIPTION:
(tag) DIVIDE field (BY) field REMAINDER field (.)
SPECIAL NOTES:
DIVIDE will divide the value in the first operand to the value of the second operand. Field type is checked and automatically converted to the receiving field's numeric type. The remainder field must be large enough to accomadate the significate digits of the divisor or an error will occur. For example, the first field might be divided by the number 123. The remainder must have at least 3 digits to handle a remainder.
The defined size of the fields is not important in the operation, but the actual data attempting to execute must fit a rigid rule. The total significant digits of the execution must not exceed 31 digits. You can divide a 15 digit number by a 15 digit number or a 29 digit number by a 3 digit number, but don't attempt a 29 digit number by a 4 digit divisor.
Numeric types are character display, packed decimal, and binary. Character types have maximum size of 31 bytes, Packed fields have limits of 31 digits (16 bytes), and binary fields have limits of 4 bytes binary. Max binary numeric value is 134,217,727 or hex '07FFFFFF'.
"tag" a name up to 8 characters for GOTO branching and is optional..
"field" is either a label reference to a DEFINES statement, a data value constant, or the
explicit usage of file, length, and position info (see DEFINES).
" . " will delimit an IF statement set and is optional.
SAMPLE: column 1 .......up to col 71
*************************************
* read and accum billed amounts *
*************************************
billed DEFINES (F=mstdd,P=1,L=10,T=P) *amt field
rem DEFINES '00' *work remainder field
start READ mstdd. *read next mst
DIVIDE billed by '12' REMAINDER rem. *compute monthly amt
EXHIBIT billed. *display amount
GOTO start. *loop until done
PURPOSE: Allows linkage from DLI process supervisor.
DESCRIPTION:
(tag) ENTRY DLITCBL (USING) pcbname ..... pcbname (-)
(tag) DLILINK |label |
|explicit |
SPECIAL NOTES:
DLI access is accomplished by calling the standard DLI processor DFSRRC00 passing the application program id of BENCH and the PSB you wish to used.
The purpose of the ENTRY verb is to declare the expected PCBs for WORKBENCH to use, and allow field definitions to those linkage areas. Note: the ENTRY must precede the DLILINK statements for proper reference resolution.
The DLILINK verb is used to associate field names to the linkage address. There are no limitations to the number of parms passed to WORKBENCH. Also these verbs have been designed to any USER written supervisor program to call WORKBENCH passing parms to activate processing.
The required JCL must now use the BENCHIMS proc. Database file names depend on the PSB you choose to use. Keep in mind, it is not necessary to create a special PSB for WORKBENCH, as your application will most likely have a PSB available with the needed access ability such as read only or update capability.
From this point on, the programmer simply uses standard DLI call patterns to position and process the file. I/O areas for reading and writing segments can be done out of WORKAREA or DEFAREA.
"tag" a name up to 8 characters for GOTO branching.
"pcbname" pcb areas sent by DLI for the PSB you choose.
"NAME=" is the pcbname given in the ENTRY statement.
"N=" same as NAME=
" . " will delimit an IF statement set.
SAMPLE: col 1 .......up to col 71
//STEP1 EXEC BENCHIMS,PSB='psbname'
//gcdinp01 DD DSN=test.gcdinp01,DISP=SHR
//gcdinp02 DD DSN=test.gcdinp02,DISP=SHR
//gcdinx1 DD DSN=test.gcdinx1,DISP=SHR
//gcdinx2 DD DSN=test.gcdinx2,DISP=SHR
//SYSIN DD *
**************************************************
* IMS DATA BASE SAMPLE
**************************************************
ENTRY DLITCBL USING pcb1.
pcb1 DLILINK (N=pcb1,P=1,L=50)
pcb1rc DLILINK (N=pcb1,P=11,L=2)
insured DEFAREA SIZE=200
insarea DEFINES (F=insured,P=1,L=200)
gn DEFINES 'GN '
ssa DEFINES 'INSURED '
total DEFINES P'0000001'
good DEFINES ' '
MOVE ' ' TO insarea.
loop CALL CBLTDLI USING gn, pcb1, insarea, ssa.
IF pcb1rc NOT EQUAL good
EXHIBIT total
EXHIBIT pcb1
GOTO EOJ.
PRINT insured.
ADD '1' TO total.
IF total > '005'
GOTO EOJ.
GOTO loop.
PURPOSE: To print vertical dumps of records in 100 byte line groups.
DESCRIPTION:
(tag) DUMPV ddname-in (.)
DUMP
SPECIAL NOTES:
The DUMPV command initiates report for output displays. Data set name, volume serial number, create date, and other report title information are automatically printed.
"tag" a name up to 8 characters for GOTO branching.
"ddname" is the input file name of the record to printed.
" . " will delimit an IF statement set.
SAMPLE: col 1 .......up to col 71
*************************************
* id, number, defined *
*************************************
mstid DEFINES (F=mstdd,L=2,P=1) *rec type loc
mstnum DEFINES (F=mstdd,L=5,P=5) *rec number loc
*************************************
* dump all except 12345 *
*************************************
start READ mstdd. *read next rec
IF mstnum EQUAL '12345' *if rec
DELETE mstdd. * skip it
DUMPV mstdd. *dump record
GOTO start. *loop until done
PURPOSE: To print horizontal dump of records in standard core dump 32 byte line groups.
DESCRIPTION:
(tag) DUMPH ddname-in (.)
SPECIAL NOTES:
The DUMPH command initiates report for output displays. Data set name, volume serial number, create date, and other report title information are automatically printed.
"tag" a name up to 8 characters for GOTO branching.
"ddname" is the input file name of the record to print.
" . " will delimit an IF statement set.
SAMPLE: col 1 .......up to col 71
*************************************
* id, number, defines *
*************************************
mstid DEFINES (F=mstdd,L=2,P=1) *rec type loc
mstnum DEFINES (F=mstdd,L=5,P=5) *rec number loc
*************************************
* core dump style all but 12345 *
*************************************
start READ mstdd. *read next mst
IF mstnum EQUAL '123456' *if num
DELETE mstdd. * skip it
DUMPH mstdd. *core dump rec
GOTO start. *loop until done
PURPOSE: To dynamically allocate files for input or output.
DESCRIPTION:
(tag) DYNALLOC ddname (USING) field, ...field (-) (.)
SPECIAL NOTES:
Dynamic allocation of files and sysout formats are initiated by Workbench by this verb. This is similar to the TSO allocate command except instead of keywords like UNIT(TESTA), Workbench passes binary request text blocks native to IBM processing.
The command DYNALLOC is a straight call to the service routine SVC 99 and passing the fields in the USING portion of the command. The command itself is not complex, but the native parameter fields required by the SVC 99 service routine is difficult. However, having Workbench be a simple pass through to SVC99, insures future compatability for MVS operating system changes. The IBM manual called System Programming Library: Job Management GC28-1303 is the best reference material for understanding dynamic file allocation. You will need a copy to translate a file attributes into their binary hex operation codes and the text area layouts.
Now for the good news, DYNALLOC supports all file allocation features available from MVS. For example, if you wish to read an input report file and split the output into different sysout classes, you can. You can read a file and dynamicly split it into multple file names and output devices. Tape, disk, diskette, sysout are simply changes in the unit parameter. The Workbench commands are the same, but the request block text fields passed will specify the changes.
The basic process of using dynamic allocation in Workbench is to ...(1) define and initialize the allocation text blocks, (2) issue the DYNALLOC command using the text blocks, (3) check the return codes for errors, (3) issue the DYNOPEN command to open the file, (4) issue normal READ, WRITE Workbench verbs on the files, (5) issue the DYCLOSE command to close the file, (6) optionally you may free the file by deallocating using another DYALLOC command to process in a loop. The DYNOPEN and DYNCLOSE verbs are Workbench specific commands to assist other Workbench commands. The DYNALLOC command is, as mentioned above, a straight pass through to SVC 99.
"tag" a name up to 8 characters for GOTO branching.
"ddname" is the file ddname to use.
USING is an optional verb for ease of reading the statement.
"field" is either a label reference to a DEFINES statement, a data value constant, or the explicit
usage of file, length, and position info (see DEFINES).
" - " used to allow multiple cards.
" . " will delimit an IF statement set.
SAMPLE:
This sample reads in a list of account numbers. It produces a unique file name based on the list and writes detail records to each file. JCL dd files are not needed because of the dynamic allocation.
Your code can be simplified and reduced by defining hex strings for the file dispositions and file attributes. The hex literals can be passes instead of defining all the text layouts and initializing them. The only layout you really need is for the variable dataset name (See the sample section for this technique). We explicitly defined the text areas in this sample in order to relate better to the IBM Job Management manual.
//STEP1 EXEC BENCH
//LIST DD *
ACCT1 THESE ACCOUNT NUMBERS WILL BE USED IN THE DATASET NAME
ACCT2 "TEST.XXXXX.OUTLIST"
ACCT3
ACCT4
//DATA DD *
DETAIL REC1 THESE RECORDS WILL BE WRITTEN TO EACH DYNAMIC FILE
DETAIL REC2
DETAIL REC3
//SYSIN DD *
*********************************************
* INPUT RECORDS *
*********************************************
ACCTNUM DEFINES (F=LIST,P=1,L=5)
DATAREC DEFINES (F=DATA,P=1,L=80)
*********************************************
* DYNALLOC REQUEST BLOCK FOR INFO MESSAGES *
*********************************************
WORK1 DEFAREA SIZE=2000
REQBLOCK DEFINES (F=WORK1,P=1,L=20)
REQBSIZE DEFINES (F=WORK1,P=1,L=1,T=X)
REQBVERB DEFINES (F=WORK1,P=2,L=1,T=X)
REQBFLG1 DEFINES (F=WORK1,P=3,L=2,T=X)
REQBERR DEFINES (F=WORK1,P=5,L=2,T=X)
REQBINFO DEFINES (F=WORK1,P=7,L=2,T=X)
REQBTEXT DEFINES (F=WORK1,P=9,L=4,T=X)
REQBRSRV DEFINES (F=WORK1,P=13,L=4,T=X)
REQBFLG2 DEFINES (F=WORK1,P=17,L=4,T=X)
*********************************************
* DYNALLOC REQUEST TEXT AREA *
*********************************************
TEXT1 DEFINES (F=WORK1,P=101,L=14)
TXT1KEY DEFINES (F=WORK1,P=101,L=2,T=X)
TXT1# DEFINES (F=WORK1,P=103,L=2,T=X)
TXT1LEN DEFINES (F=WORK1,P=105,L=2,T=X)
TXT1DATA DEFINES (F=WORK1,P=107,L=6,T=C)
TEXT2 DEFINES (F=WORK1,P=201,L=24)
TXT2KEY DEFINES (F=WORK1,P=201,L=2,T=X)
TXT2# DEFINES (F=WORK1,P=203,L=2,T=X)
TXT2LEN DEFINES (F=WORK1,P=205,L=2,T=X)
TXT2DATA DEFINES (F=WORK1,P=207,L=18,T=C)
TXT2ACCT DEFINES (F=WORK1,P=212,L=5,T=C)
TEXT3 DEFINES (F=WORK1,P=301,L=7)
TXT3KEY DEFINES (F=WORK1,P=301,L=2,T=X)
TXT3# DEFINES (F=WORK1,P=303,L=2,T=X)
TXT3LEN DEFINES (F=WORK1,P=305,L=2,T=X)
TXT3DATA DEFINES (F=WORK1,P=307,L=1,T=X)
TEXT4 DEFINES (F=WORK1,P=401,L=7)
TXT4KEY DEFINES (F=WORK1,P=401,L=2,T=X)
TXT4# DEFINES (F=WORK1,P=403,L=2,T=X)
TXT4LEN DEFINES (F=WORK1,P=405,L=2,T=X)
TXT4DATA DEFINES (F=WORK1,P=407,L=1,T=X)
TEXT5 DEFINES (F=WORK1,P=501,L=7)
TXT5KEY DEFINES (F=WORK1,P=501,L=2,T=X)
TXT5# DEFINES (F=WORK1,P=503,L=2,T=X)
TXT5LEN DEFINES (F=WORK1,P=505,L=2,T=X)
TXT5DATA DEFINES (F=WORK1,P=507,L=1,T=X)
TEXT6 DEFINES (F=WORK1,P=601,L=10)
TXT6KEY DEFINES (F=WORK1,P=601,L=2,T=X)
TXT6# DEFINES (F=WORK1,P=603,L=2,T=X)
TXT6LEN DEFINES (F=WORK1,P=605,L=2,T=X)
TXT6DATA DEFINES (F=WORK1,P=607,L=4,T=C)
TEXT7 DEFINES (F=WORK1,P=701,L=4)
TXT7KEY DEFINES (F=WORK1,P=701,L=2,T=X)
TXT7# DEFINES (F=WORK1,P=703,L=2,T=X)
TEXT8 DEFINES (F=WORK1,P=801,L=9)
TXT8KEY DEFINES (F=WORK1,P=801,L=2,T=X)
TXT8# DEFINES (F=WORK1,P=803,L=2,T=X)
TXT8LEN DEFINES (F=WORK1,P=805,L=2,T=X)
TXT8DATA DEFINES (F=WORK1,P=807,L=3,T=X)
TEXT9 DEFINES (F=WORK1,P=901,L=8)
TXT9KEY DEFINES (F=WORK1,P=901,L=2,T=X)
TXT9# DEFINES (F=WORK1,P=903,L=2,T=X)
TXT9LEN DEFINES (F=WORK1,P=905,L=2,T=X)
TXT9DATA DEFINES (F=WORK1,P=907,L=2,T=X)
TEXTA DEFINES (F=WORK1,P=1001,L=8)
TXTAKEY DEFINES (F=WORK1,P=1001,L=2,T=X)
TXTA# DEFINES (F=WORK1,P=1003,L=2,T=X)
TXTALEN DEFINES (F=WORK1,P=1005,L=2,T=X)
TXTADATA DEFINES (F=WORK1,P=1007,L=2,T=X)
TEXTB DEFINES (F=WORK1,P=1101,L=7)
TXTBKEY DEFINES (F=WORK1,P=1101,L=2,T=X)
TXTB# DEFINES (F=WORK1,P=1103,L=2,T=X)
TXTBLEN DEFINES (F=WORK1,P=1105,L=2,T=X)
TXTBDATA DEFINES (F=WORK1,P=1107,L=1,T=X)
TEXTC DEFINES (F=WORK1,P=1201,L=7)
TXTCKEY DEFINES (F=WORK1,P=1201,L=2,T=X)
TXTC# DEFINES (F=WORK1,P=1203,L=2,T=X)
TXTCLEN DEFINES (F=WORK1,P=1205,L=2,T=X)
TXTCDATA DEFINES (F=WORK1,P=1207,L=1,T=X)
TEXTD DEFINES (F=WORK1,P=1301,L=7)
TXTDKEY DEFINES (F=WORK1,P=1301,L=2,T=X)
TXTD# DEFINES (F=WORK1,P=1303,L=2,T=X)
TXTDLEN DEFINES (F=WORK1,P=1305,L=2,T=X)
TXTDDATA DEFINES (F=WORK1,P=1307,L=1,T=X)
TEXTE DEFINES (F=WORK1,P=1401,L=7)
TXTEKEY DEFINES (F=WORK1,P=1401,L=2,T=X)
TXTE# DEFINES (F=WORK1,P=1403,L=2,T=X)
TXTELEN DEFINES (F=WORK1,P=1405,L=2,T=X)
TXTEDATA DEFINES (F=WORK1,P=1407,L=1,T=X)
**********************************************
* WORKBENCH PROCEDURE COMMANDS - INIT *
* DYNAMIC REQUEST BLOCKS *
**********************************************
CVTBIN '01' TO TXT1KEY. *REQUEST DDNAME (HEX CODE=0001)
CVTBIN '01' TO TXT1#. *1 INDICATES 1 FIELD IN TEXT AREA
CVTBIN '06' TO TXT1LEN. *6 IS THE SIZE OF THE DDNAME FIELD
MOVE 'OUTPUT' TO TXT1DATA. *"OUTPUT" WILL BE THE DYNAMIC DD
CVTBIN '02' TO TXT2KEY. *TO THIS DATASET NAME (HEX =0002)
CVTBIN '01' TO TXT2#. *1 FIELD IN TEXT AREA
CVTBIN '18' TO TXT2LEN. *18 SIZE OF THE DATASET NAME
MOVE 'TEST.ACCTX.OUTLIST' TO TXT2DATA.
CVTBIN '04' TO TXT3KEY. *DISP=(NEW,---,---) INITIAL DISP
CVTBIN '01' TO TXT3#. *1 FIELD IN TEXT AREA
CVTBIN '01' TO TXT3LEN. *1 BYTE LONG
CVTBIN '04' TO TXT3DATA. *NEW = HEX CODE 04
CVTBIN '05' TO TXT4KEY. *DISP=(---,CATLG NORMAL COMPLETION
CVTBIN '01' TO TXT4#. *1 FIELD
CVTBIN '01' TO TXT4LEN. *1 BYTE LONG
CVTBIN '02' TO TXT4DATA. *CATLG = HEX CODE 02
CVTBIN '06' TO TXT5KEY. *DISP=(---,---,DELETE) ABEND COMPL
CVTBIN '01' TO TXT5#. *1 FIELD
CVTBIN '01' TO TXT5LEN. *1 BYTE LONG TEXT AREA
CVTBIN '04' TO TXT5DATA. *DELETE = HEX CODE 04
MOVE X'0015' TO TXT6KEY. *UNIT=TEST
CVTBIN '01' TO TXT6#. *
CVTBIN '04' TO TXT6LEN. *UNIT VALUE SUCH AS TAPE, DISK,
MOVE 'TEST' TO TXT6DATA. * TEST, PROD, DSKET, ETC
MOVE X'0007' TO TXT7KEY. *SPACE=TRACKS
CVTBIN '00' TO TXT7#.
MOVE X'000A' TO TXT8KEY. *SPACE PRIMARY 5 TRKS
CVTBIN '01' TO TXT8#.
CVTBIN '03' TO TXT8LEN.
CVTBIN '05' TO TXT8DATA.
MOVE X'0030' TO TXT9KEY. *BLKSIZE =8000
CVTBIN '01' TO TXT9#.
CVTBIN '02' TO TXT9LEN.
CVTBIN '8000' TO TXT9DATA.
MOVE X'0042' TO TXTAKEY. *LRECL =80
CVTBIN '01' TO TXTA#.
CVTBIN '02' TO TXTALEN.
CVTBIN '80' TO TXTADATA.
MOVE X'0049' TO TXTBKEY. *RECFM= X'10' + '80'
CVTBIN '01' TO TXTB#.
CVTBIN '01' TO TXTBLEN.
MOVE X'90' TO TXTBDATA.
CVTBIN '04' TO TXTCKEY. *DISP=(MOD,
CVTBIN '01' TO TXTC#.
CVTBIN '01' TO TXTCLEN.
CVTBIN '02' TO TXTCDATA.
CVTBIN '05' TO TXTDKEY. *DISP=(MOD,DELETE
CVTBIN '01' TO TXTD#.
CVTBIN '01' TO TXTDLEN.
CVTBIN '04' TO TXTDDATA.
CVTBIN '06' TO TXTEKEY. *DISP=(MOD,DELETE,DELETE)
CVTBIN '01' TO TXTE#.
CVTBIN '01' TO TXTELEN.
CVTBIN '04' TO TXTEDATA.
CVTBIN '20' TO REQBSIZE.
CVTBIN '01' TO REQBVERB. *REQUEST ALLOC DDNAME
CVTBIN '00' TO REQBFLG1.
CVTBIN '00' TO REQBERR.
CVTBIN '00' TO REQBINFO.
CVTBIN '00' TO REQBTEXT.
CVTBIN '00' TO REQBRSRV.
CVTBIN '00' TO REQBFLG2.
DUMP WORK1. *DUMP THE PARAMETERS TO VERIFY CODES
**********************************************
* WORKBENCH PROCESS LOOP *
**********************************************
* FOR EVERY ACCT ON THE LIST FILE *
* DELETE A VARIABLE FILE NAME IF EXISTS *
* CREATE A VARIABLE DATASET NAME *
* "TEST.XXXXX.OUTLIST" *
* WRITE THE DETAIL RECS TO EACH FILE *
* LOOP FOR NEXT ACCOUNT *
**********************************************
LOOP1 READ LIST. *READ THE CONTROL LIST
IF RECORDSW OF LIST = 'Y' *IF DONE, STOP JOB
GOTO EOJ. *
MOVE ACCTNUM TO TXT2ACCT *
EXHIBIT 'BUILDING FILE:' *DISPLAY THE FILE NAME
EXHIBIT TXT2DATA *
CVTBIN '01' TO REQBVERB. *REQUEST ALLOC DSNAME "MOD"
** *DELETE THE FILE IF PRESENT
DYNALLOC OUTPUT USING REQBLOCK, TEXT1, TEXT2, TEXTC, TEXTD, -
TEXTE, TEXT6, TEXT7, TEXT8, -
TEXT9, TEXTA, TEXTB.
IF REQBERR NOT = '0' *DISPLAY ANY ERRORS
EXHIBIT REQBERR * DELETING A NON-EXISTING FILE
EXHIBIT REQBINFO. * WILL GIVE A MESSAGE
CVTBIN '02' TO REQBVERB. *REQUEST DEALLOCATE DSNAME
** *DELETE THE FILE IF PRESENT
DYNALLOC OUTPUT USING REQBLOCK, TEXT1, TEXT2.
IF REQBERR NOT = '0' *DISPLAY ANY ERRORS
EXHIBIT REQBERR *
EXHIBIT REQBINFO. *
** *ALLOCATE THE FILE
CVTBIN '01' TO REQBVERB. *REQUEST ALLOC DSNAME
DYNALLOC OUTPUT USING REQBLOCK, TEXT1, TEXT2, TEXT3, TEXT4, -
TEXT5, TEXT6, TEXT7, TEXT8, -
TEXT9, TEXTA, TEXTB.
IF REQBERR NOT = '0' *DISPLAY ANY ERRORS
EXHIBIT REQBERR *
EXHIBIT REQBINFO. *
DYNOPEN OUTPUT. *OPEN THE DYNAMIC FILE
******************************************
* OUTPUT THE GIVEN FILE *
******************************************
LOOP2 READ DATA. *
IF RECORDSW OF DATA = 'Y' *
DYNCLOSE OUTPUT *CLOSE THE DYNAMIC FILE
CVTBIN '02' TO REQBVERB *REQUEST DEALLOCATE DSNAME
DYNALLOC OUTPUT USING REQBLOCK, TEXT1, TEXT2
RESTART DATA *
GOTO LOOP1. *
WRITE OUTPUT FROM DATA. *OUTPUT THE DATA RECORD
GOTO LOOP2. *
//
PURPOSE: To dynamically close a file that was opened using DYNOPEN and previously allocated using
DYNALLOC.
DESCRIPTION:
(tag) DYNCLOSE ddname (.)
SPECIAL NOTES:
This verb is used in conjunction with the DYNALLOC. Please see the DYNALLOC special notes.
"tag" a name up to 8 characters for GOTO branching.
"ddname" is the file ddname to close.
" . " will delimit an IF statement set.
SAMPLE:
(Partial sample.....see DYNALLOC for complete sample)
**********************************************
* WORKBENCH PROCESS LOOP *
**********************************************
* FOR EVERY ACCT ON THE LIST FILE *
* DELETE A VARIABLE FILE NAME IF EXISTS *
* CREATE A VARIABLE DATASET NAME *
* "TEST.XXXXX.OUTLIST" *
* WRITE THE DETAIL RECS TO EACH FILE *
* LOOP FOR NEXT ACCOUNT *
**********************************************
LOOP1 READ LIST. *READ THE CONTROL LIST
IF RECORDSW OF LIST = 'Y' *IF DONE, STOP JOB
GOTO EOJ. *
MOVE ACCTNUM TO TXT2ACCT *
** *ALLOCATE THE FILE
CVTBIN '01' TO REQBVERB. *REQUEST ALLOC DSNAME
DYNALLOC OUTPUT USING REQBLOCK, TEXT1, TEXT2, TEXT3, TEXT4, -
TEXT5, TEXT6, TEXT7, TEXT8, -
TEXT9, TEXTA, TEXTB.
DYNOPEN OUTPUT. *OPEN THE DYNAMIC FILE
LOOP2 READ DATA. *
IF RECORDSW OF DATA = 'Y' *
DYNCLOSE OUTPUT *CLOSE THE DYNAMIC FILE
CVTBIN '02' TO REQBVERB *REQUEST DEALLOCATE DSNAME
DYNALLOC OUTPUT USING REQBLOCK, TEXT1, TEXT2
RESTART DATA *
GOTO LOOP1. *
WRITE OUTPUT FROM DATA. *OUTPUT THE DATA RECORD
GOTO LOOP2. *
PURPOSE: To dynamically open a file that was previously allocated using DYNALLOC.
DESCRIPTION:
(tag) DYNOPEN ddname (.)
SPECIAL NOTES:
This verb is used in conjunction with the DYNALLOC. Please see the DYNALLOC special notes.
"tag" a name up to 8 characters for GOTO branching.
"ddname" is the file ddname to open.
" . " will delimit an IF statement set.
SAMPLE:
(Partial sample.....see DYNALLOC for complete sample)
**********************************************
* WORKBENCH PROCESS LOOP *
**********************************************
* FOR EVERY ACCT ON THE LIST FILE *
* DELETE A VARIABLE FILE NAME IF EXISTS *
* CREATE A VARIABLE DATASET NAME *
* "TEST.XXXXX.OUTLIST" *
* WRITE THE DETAIL RECS TO EACH FILE *
* LOOP FOR NEXT ACCOUNT *
**********************************************
LOOP1 READ LIST. *READ THE CONTROL LIST
IF RECORDSW OF LIST = 'Y' *IF DONE, STOP JOB
GOTO EOJ. *
MOVE ACCTNUM TO TXT2ACCT *
** *ALLOCATE THE FILE
CVTBIN '01' TO REQBVERB. *REQUEST ALLOC DSNAME
DYNALLOC OUTPUT USING REQBLOCK, TEXT1, TEXT2, TEXT3, TEXT4, -
TEXT5, TEXT6, TEXT7, TEXT8, -
TEXT9, TEXTA, TEXTB.
DYNOPEN OUTPUT. *OPEN THE DYNAMIC FILE
LOOP2 READ DATA. *
IF RECORDSW OF DATA = 'Y' *
DYNCLOSE OUTPUT *CLOSE THE DYNAMIC FILE
CVTBIN '02' TO REQBVERB *REQUEST DEALLOCATE DSNAME
DYNALLOC OUTPUT USING REQBLOCK, TEXT1, TEXT2
RESTART DATA *
GOTO LOOP1. *
WRITE OUTPUT FROM DATA. *OUTPUT THE DATA RECORD
GOTO LOOP2. *
PURPOSE: To move data with automatic shifting of the record's data. Used for JCL or source code
data replacement needs.
DESCRIPTION:
(tag) EDIT field (TO) field (.)
SPECIAL NOTES:
EDIT is identical to a MOVE verb request except when the sending field and the receiving field have different lengths. When the sending field is smaller, the data is replaced and shifted to the left. When the sending field is larger, the data is inserted into the record shifting to the right using excess blanks. This process is equivalent to a text editor "replace" or "change" request.
Overflow messages will appear on report R01 if a right shift request does not have enough excess blanks to be satisfied.
"tag" a name up to 8 characters for GOTO branching.
"field" is either a label reference to a DEFINES statement, a data value constant, or the explicit
usage of file, length, and position info (see DEFINES).
" . " will delimit an IF statement set.
SAMPLE: col 1.......up to col 71
*************************************
* edit sample *
*************************************
newut DEFINES C'WK1' *new unit
oldut DEFINES (F=in,P=LOC,L=5) *unit data
slash DEFINES (F=in,P=1,L=2) *slash
start READ in. *read rec
SCANTEST in FOR 'SYSDK'. *scan for value
IF SCANHIT OF in = 'Y' *if found
EDIT newut TO oldut * replace unit
EDIT '//*' TO slash. * comment out
WRITE out FROM in. *
GOTO start. *loop
PURPOSE: To encrypt data records or individual fields by reformatting the data into unreadable
binary values.
DESCRIPTION: (tag) ENCODE ddname-in (USING) field (.)
SPECIAL NOTES:
ENCODE will encrypt data records by using an eight byte key to seed the encryption processor. Max record size for processing is 256 either fixed or variable record formats. Individual field encryption is possible. Password must be 8 bytes is size. See Sample 66 for details.
Several encoding techniques are allowed beyond the normal single encode request as shown in the sample below. One of these techniques is to use multiple ENCODE verbs prior to writing the record. The net effect is to encode the previously encoded record.
A second technique involves the encoding records by using a counter to change the password key for each individual record. Using this approach provides the best protection as each record has a maximum of 256 to the power of 8, decode combinations plus the ability to employ a multiple of encode requests. In order to decode the file, simply substitute the ENCODE verb for DECODE and reprocess the file.
Word of caution.....do not modify an encoded record, shorten the record lengths, or formats (VB to FB etc). The encode/decode facility rely on record lengths.
"tag" a name up to 8 characters for GOTO branching.
"field" is either a label reference to a DEFINES statement, a data value constant, or the explicit
usage of file, length, and position info (see DEFINES).
" . " will delimit an IF statement set.
SAMPLE: col 1 .....up to col 71
*************************************
* encrypt admin memo members *
*************************************
password DEFINES 'TENNIS ' *encryption key
loop READPDS textin FOR admin*** *read members
ENCODE textin USING password. *encode rec
WRITEPDS textout FROM textin. *rewrite mem
GOTO loop.
PURPOSE: To delete database records.
ENVIRONMENT: IDMS data base manager only.
DESCRIPTION:
(tag) ERASE field (PERMANENT MEMBERS) (.)
(SELECTIVE MEMBERS)
(ALL MEMBERS)
SPECIAL NOTES:
Database records deleted are not committed until a FINISH or COMMIT is issued.
"tag" a name up to 8 characters for GOTO branching.
"field" is either a label reference to a DEFINES statement, a data value constant, or the explicit
usage of file, length, and position info (see DEFINES).
" . " will delimit an IF statement set.
SAMPLE: col 1 .....up to col 71
*****************************************************
* idms area sweep to delete records *
*****************************************************
umtcxfr DEFAREA SIZE=220 *memory workarea
rec1work DEFINES (F=umtcxfr,P=1,L=220) *full work size
acct DEFINES (F=umtcxfr,P=7,L=5) *account id
db1name DEFINES 'dev5dict ' *db names must be 16 bytes
ss1name DEFINES 'intssc01 ' *schema name must be 16 bytes
rc1name DEFINES 'umtcxfr ' *record name - 16 bytes
ar1name DEFINES 'pend-area ' *area name - 16 bytes
start BIND RUN-UNIT FOR ss1name DBNAME db1name. *bind run unit
BIND rc1name TO rc1work. *declare rec to storage
READY ar1name USAGE-MODE IS UPDATE. *update mode
OBTAIN FIRST rc1name WITHIN AREA ar1name. *area sweep 1st rec
loop IF IDMS-STATUS NOT = '0000' *if read failed
EXHIBIT IDMS-STATUS * yes-display
GOTO done. * -exit
IF acct = 'AU123' *if account found
PRINT umtcxfr * yes-print record
ERASE rc1name * -delete the record
IF IDMS-STATUS NOT = '0000' * -test if ok
EXHIBIT IDMS-STATUS * -display error
ROLLBACK * -rollback update
GOTO done. * -exit
ADD '1' TO COUNTIN OF umtcxfr. *manually up counts
OBTAIN NEXT rc1name WITHIN AREA ar1name. *read next record
GOTO loop. *loop for more
done FINISH. *terminate DBMS
EXHIBIT '---total records---'. *display counts
EXHIBIT COUNTIN OF umtcxfr. *
GOTO EOJ. *shutdown
PURPOSE: To pass IBM's DB2 SQL syntax to the dynamic SQL processor.
ENVIRONMENT: DB2 data base manager only.
DESCRIPTION:
(tag) EXEC SQL
...q END-EXEC($ (.)SPECIAL NOTES:
EXEC SQL is the keyword Workbench uses to begin loading the SQL buffer and begin the dynamic preprocessor. When the END-EXEC is found, the load is complete and prep/bind process begins. Anything in between those two keywords is considered SQL syntax and follows IBM's SQL format. Therefore, Workbench comments and syntax style is not active between the EXEC SQL and the END-EXEC.
Workbench provides substitutions of variables by using the ":" colon. The Workbench label following the colon will be replaced by the data value or literal currently in memory at the time of execution. Substitution is normally done for the WHERE clause of selects and the INTO clause. However, you may request substitution of table names, data element names, or entire SQL statements. Variables of table names can be read from a control file and used to invoke a general purpose dump routine, if desired.
There are limitations on the verbs that can be handled by dynamic SQL. See the DB2 Application guide on verb limitation for dynamic SQL. Workbench has a maximum of 10 separate cursors per run. To access IMS and DB2 in the same run, use proc BENCHIMS. IDMS and DB2 use the standard BENCH proc.
"tag" a tag name up to 8 characters used for GOTO branching.
" . " will delimit an IF statement set.
SAMPLE: col 1 .....up to col 71
*****************************************************
* db2 record dump *
*****************************************************
account DEFAREA SIZE=220 *memory workarea
rec1work DEFINES (F=account,P=1,L=220) *full work size
acctid DEFINES (F=account,P=1,L=5) *acct id
acctname DEFINES (F=account,P=6,L=40) *acct name
acctbal DEFINES (F=account,P=46,L=8,T=P) *acct amount
date DEFINES '05/12/1990' *search date
DB2-CONNECT SYSTEM=DB2T. *connect to db2
EXEC SQL DECLARE cur1 CURSOR
SELECT account_id, account_name, beg_balance
FROM db2.paxkact
WHERE CHAR(account_date,USA) = :date END-EXEC.
* *open cursor
EXEC SQL OPEN cur1 END-EXEC.
* *read first row
loop EXEC SQL FETCH cur1
INTO :acctid, :acctname, :acctbal END-EXEC.
IF SQLCODE NOT = '0' *if read failed
EXHIBIT SQLCODE * yes-display
GOTO done. * -exit
ADD '1' TO COUNTIN OF account. *manually up counts
PRINT account. *print record
DUMP account. *dump record
GOTO loop. *loop for more
done EXEC SQL CLOSE cur1 END-EXEC. *close cursor
DB2-DISCONNECT. *terminate DBMS
EXHIBIT '---total records---'. *display counts
EXHIBIT COUNTIN OF account. *
GOTO EOJ. *shutdown
PURPOSE: To display a data field.
DESCRIPTION:
(tag) EXHIBIT field (.)
SPECIAL NOTES:
EXHIBIT displays a field on report R01. Character data is moved and printed. Packed numeric and binary fields are converted and printed in display format.
Definition of a field type comes from the TYPE Keyword or literal definition. See DEFINES verb for more information.
"tag" a name up to 8 characters for GOTO branching.
"field" is either a label reference to a DEFINES statement, a data value constant, or the explicit
usage of file, length, and position info (see DEFINES).
" . " will delimit an IF statement set.
SAMPLE: col 1 .......up to col 71
*************************************
* edit sample *
*************************************
title DEFINES C'DEMO DISPLAY' *new unit
amount DEFINES (F=in,P=5,L=6,T=P) *unit data
rdw DEFINES (F=in,P=1,L=2,T=X) *slash
start READ in. *read rec
EXHIBIT ' '. *display
EXHIBIT title. *display
EXHIBIT amount. *display
EXHIBIT rdw. *display
GOTO start. *loop
PURPOSE: To locate an IDMS database record, but only set a pointer.
ENVIRONMENT: IDMS data base manager only.
DESCRIPTION:
Format 1.
(tag) FIND (KEEP) (EXCLUSIVE) (FIRST) field (WITHIN) (AREA) field (.)
(LAST)
(PRIOR)
(NEXT)
Format 2.
(tag) FIND (KEEP) (EXCLUSIVE) (CURRENT) WITHIN (AREA) field (.)
(FIRST)
(LAST)
(NEXT)
(PRIOR)
(OWNER)
(DBKEY)
(DUPLICATE)
Other Formats:
(tag) FIND (KEEP) (EXCLUSIVE) field DB-KEY IS field (.)
(tag) FIND (KEEP) (EXCLUSIVE) field WITHIN field CURRENT USING field (.)
(tag) FIND (KEEP) (EXCLUSIVE) field field WITHIN (AREA) field (.)
(tag) FIND (KEEP) (EXCLUSIVE) CALC (ANY) (.)
SPECIAL NOTES:
FIND is the verb to access IDMS database records. It's command syntax is the same as the OBTAIN, but the result is only a pointer to the record. FIND is used walk the record paths without the slow down of transfering data into working storage. See OBTAIN for related information.
"tag" a name up to 8 characters for GOTO branching.
"field" is either a label reference to a DEFINES statement, a data value constant, or the explicit
usage of file, length, and position info (see DEFINES).
" . " will delimit an IF statement set.
SAMPLE: col 1 .....up to col 71
*****************************************************
* idms area sweep to dump selected record *
*****************************************************
umtcxfr DEFAREA SIZE=220 *memory workarea
rec1work DEFINES (F=umtcxfr,P=1,L=220) *full work size
db1name DEFINES 'dev5dict ' *db names must be 16 bytes
ss1name DEFINES 'intssc01 ' *schema name must be 16 bytes
rc1name DEFINES 'umtcxfr ' *record name - 16 bytes
ar1name DEFINES 'pend-area ' *area name - 16 bytes
start BIND RUN-UNIT FOR ss1name DBNAME db1name. *bind run unit
BIND rc1name TO rc1work. *declare rec to storage
READY ar1name USAGE-MODE IS RETRIEVAL. *read only mode
FIND FIRST rc1name WITHIN AREA ar1name. *area sweep 1st rec
loop IF IDMS-STATUS NOT = '0000' *if read failed
EXHIBIT IDMS-STATUS * yes-display
GOTO done. * -exit
IF COUNTIN OF umtcxfr = '56' *if 56th record
OBTAIN CURRENT rc1name *yes-read for data
PRINT umtcxfr * -print record
DUMP umtcxfr * -dump record
GOTO done. * -terminate
ADD '1' TO COUNTIN OF umtcxfr. *manually up counts
FIND NEXT rc1name WITHIN AREA ar1name. *read next record
GOTO loop. *loop for more
done FINISH. *terminate DBMS
EXHIBIT '---total records---'. *display counts
EXHIBIT COUNTIN OF umtcxfr. *
GOTO EOJ. *shutdown
PROCESS:
o The DEFAREA creates a buffer area to receive the database record.
o Connect to IDMS by binding the run-unit to the database and DML subschema.
LRF subschemas are not supported.
o Indicate where the record is to be stored.
o READY the area in read mode or update mode.
o Locate records, test for status codes. On the 56th record, print and dump it.
o When the status is not zeros, disconnect from IDMS with the FINISH verb and terminate the
task by using GOTO EOJ.
PURPOSE: To disconnect task from the IDMS data manager.
ENVIRONMENT: IDMS data base manager only.
DESCRIPTION:
(tag) FINISH (.)
SPECIAL NOTES:
FINISH is the IDMS verb to terminate connection to the database manager and free its related resources.
"tag" a name up to 8 characters for GOTO branching.
" . " will delimit an IF statement set.
SAMPLE: col 1 .....up to col 71
*****************************************************
* idms area sweep to dump out records *
*****************************************************
umtcxfr DEFAREA SIZE=220 *memory workarea
rec1work DEFINES (F=umtcxfr,P=1,L=220) *full work size
db1name DEFINES 'dev5dict ' *db names must be 16 bytes
ss1name DEFINES 'intssc01 ' *schema name must be 16 bytes
rc1name DEFINES 'umtcxfr ' *record name - 16 bytes
ar1name DEFINES 'pend-area ' *area name - 16 bytes
start BIND RUN-UNIT FOR ss1name DBNAME db1name.*bind run unit
BIND rc1name TO rc1work. *declare rec to storage
READY ar1name USAGE-MODE IS RETRIEVAL. *read only mode
OBTAIN FIRST rc1name WITHIN AREA ar1name.*area sweep 1st rec
loop IF IDMS-STATUS NOT = '0000' *if read failed
EXHIBIT IDMS-STATUS * yes-display
GOTO done. * -exit
ADD '1' TO COUNTIN OF umtcxfr. *manually up counts
PRINT umtcxfr. *print record
DUMP umtcxfr. *dump record
OBTAIN NEXT rc1name WITHIN AREA ar1name. *read next record
GOTO loop. *loop for more
done FINISH. *terminate DBMS
EXHIBIT '---total records---'. *display counts
EXHIBIT COUNTIN OF umtcxfr. *
GOTO EOJ. *shutdown
PURPOSE: To move record data into storage using the current pointer.
ENVIRONMENT: IDMS data base manager only.
DESCRIPTION:
(tag) GET (field) (.)
SPECIAL NOTES:
This verb is used with the FIND verb to transfer the desired record data. By issuing FINDs, the data manager does not have to physically move data, making data searches/scans faster. Once the desired record is found, issue the GET to request the data transfer.
"tag" a name up to 8 characters for GOTO branching.
"field" is either a label reference to a DEFINES statement, a data value constant, or the explicit
usage of file, length, and position info (see DEFINES).
" . " will delimit an IF statement set.
SAMPLE: col 1 .....up to col 71
*****************************************************
* idms GET sample *
*****************************************************
umtcxfr DEFAREA SIZE=220 *memory workarea
rec1work DEFINES (F=umtcxfr,P=1,L=220) *full work size
acct DEFINES (F=umtcxfr,P=7,L=5) *account id
amount DEFINES (F=umtcxfr,P=57,L=6,T=P) *amount field
db1name DEFINES 'dev5dict ' *db names must be 16 bytes
ss1name DEFINES 'intssc01 ' *schema name must be 16 bytes
rc1name DEFINES 'umtcxfr ' *record name - 16 bytes
ar1name DEFINES 'pend-area ' *area name - 16 bytes
start BIND RUN-UNIT FOR ss1name DBNAME db1name. *bind run unit
BIND rc1name TO rc1work. *declare rec to storage
READY ar1name USAGE-MODE IS UPDATE. *update mode
FIND FIRST rc1name WITHIN AREA ar1name. *area sweep 1st rec
loop IF IDMS-STATUS NOT = '0000' *if read failed
EXHIBIT IDMS-STATUS * yes-display
GOTO done. * -exit
IF COUNTIN OF umntcxfr = '40' *if record number found
GET umtcxfr * yes-get data
PRINT umtcxfr * -print record
MOVE P'+00012060048' * -zap the data
MODIFY rc1name * -update the record
PRINT umtcxfr * -print after image
IF IDMS-STATUS NOT = '0000' * -test if ok
EXHIBIT IDMS-STATUS * -display error
ROLLBACK * -rollback update
GOTO done. * -exit
ADD '1' TO COUNTIN OF umtcxfr. *manually up counts
FIND NEXT rc1name WITHIN AREA ar1name. *read next record
GOTO loop. *loop for more
done FINISH. *terminate DBMS
EXHIBIT '---total records---'. *display counts
EXHIBIT COUNTIN OF umtcxfr. *
GOTO EOJ. *shutdown
PURPOSE: To branch to selected process statements or end of job.
DESCRIPTION:
(tag) GOTO |tag | (.)
|EOJ|
SPECIAL NOTES:
GOTO will branch to another command statement as requested.
"tag" a name up to 8 characters for GOTO branching.
"EOJ" is the special tag to stop processing.
" . " will delimit an IF statement set.
SAMPLE: col 1 .......up to col 71
*************************************
* id and limit defined *
*************************************
mstid DEFINES (F=mstdd,L=2,P=1) *rec type loc
limit DEFINES '100' *rec count limit
*************************************
* read 100 recs, select & write *
*************************************
start READ mstdd. *read next mst
IF COUNTIN OF mstdd > limit *if 100 rec read
GOTO EOJ. * Yes-stop job
IF mstid EQUAL '88' *if rec type found
WRITE mstout FROM mstdd. * write record
GOTO start. *loop until done
PURPOSE: Used to include a record in a given path chain.
ENVIRONMENT: IDMS data base manager only.
DESCRIPTION:
(tag) IDMS-CONNECT field (.)
SPECIAL NOTES:
Database records inserted but not committed until a FINISH or COMMIT is issued.
"tag" a name up to 8 characters for GOTO branching.
"field" is either a label reference to a DEFINES statement, a data value constant, or the explicit
usage of file, length, and position info (see DEFINES).
" . " will delimit an IF statement set.
SAMPLE: col 1 .....up to col 71
*****************************************************
* idms insert transactions under a given tran type *
*****************************************************
txntype DEFAREA SIZE=100 *memory workarea
txndtl DEFAREA SIZE=220 *memory workarea
rec1work DEFINES (F=txntype,P=1,L=100) *full work size
txnid DEFINES (F=txntype,P=1,L=5) *tran id
extract DEFINES (F=filein,P=1,L=100) *flat file extracts
rec2work DEFINES (F=txndtl,P=1,L=100) *full work size
amount DEFINES (F=txndtl,P=57,L=6,T=P) *amount field
db1name DEFINES 'dev5dict ' *db names must be 16 bytes
ss1name DEFINES 'intssc01 ' *schema name must be 16 bytes
rc1name DEFINES 'txntype ' *parent name - 16 bytes
rc2name DEFINES 'txndtl ' *detail name - 16 bytes
path1 DEFINES 'txntype-txndtl ' *path name - 16 bytes
ar1name DEFINES 'txn-area ' *area name - 16 bytes
start BIND RUN-UNIT FOR ss1name DBNAME db1name.*bind run unit
BIND rc1name TO rc1work. *declare rec to storage
BIND rc2name TO rc2work. *declare rec to storage
READY ar1name USAGE-MODE IS UPDATE. *update mode
READ filein. *read flat file of extracts
PRINT trndtl. *print image
MOVE extract TO rc2work. *load data to work
STORE rc2name. *insert database record
IF IDMS-STATUS NOT = '0000' *test if ok
EXHIBIT IDMS-STATUS * -display error
ROLLBACK * -rollback updates
GOTO epilogue. * -exit
MOVE 'C4123' TO txnid. *pre set tran id
OBTAIN CALC rc1name. *read direct key on txnid
IF IDMS-STATUS NOT = '0000' *test if ok
EXHIBIT IDMS-STATUS * -display error
ROLLBACK * -rollback updates
GOTO epilogue. * -exit
IDMS-CONNECT rc2name TO rc1name. *assign detail to group
IF IDMS-STATUS NOT = '0000' *test if ok
EXHIBIT IDMS-STATUS * -display error
ROLLBACK * -rollback updates
GOTO epilogue. * -exit
EPILOGUE FINISH. *terminate DBMS
GOTO EOJ. *shutdown
PURPOSE: Used to disconnect a record from a given path.
ENVIRONMENT: IDMS data base manager only.
DESCRIPTION:
(tag) IDMS-DISCONNECT field (.)
SPECIAL NOTES:
Database records inserted but not committed until a FINISH or COMMIT is issued.
"tag" a name up to 8 characters for GOTO branching.
"field" is either a label reference to a DEFINES statement, a data value constant, or the explicit
usage of file, length, and position info (see DEFINES).
" . " will delimit an IF statement set.
SAMPLE: col 1 .....up to col 71
*****************************************************
* idms disconnect a transaction record *
*****************************************************
txntype DEFAREA SIZE=100 *memory workarea
txndtl DEFAREA SIZE=220 *memory workarea
rec1work DEFINES (F=txntype,P=1,L=100) *full work size
txnid DEFINES (F=txntype,P=1,L=5) *tran id
rec2work DEFINES (F=txndtl,P=1,L=100) *full work size
amount DEFINES (F=txndtl,P=57,L=6,T=P) *amount field
db1name DEFINES 'dev5dict ' *db names must be 16 bytes
ss1name DEFINES 'intssc01 ' *schema name must be 16 bytes
rc1name DEFINES 'txntype ' *parent name - 16 bytes
rc2name DEFINES 'txndtl ' *detail name - 16 bytes
path1 DEFINES 'txntype-txndtl ' *path name - 16 bytes
ar1name DEFINES 'txn-area ' *area name - 16 bytes
start BIND RUN-UNIT FOR ss1name DBNAME db1name.*bind run unit
BIND rc1name TO rc1work. *declare rec to storage
BIND rc2name TO rc2work. *declare rec to storage
READY ar1name USAGE-MODE IS UPDATE. *update mode
MOVE 'C4123' TO txnid. *pre set tran id
OBTAIN CALC rc1name. *read direct key on txnid
OBTAIN FIRST rc2name WITHIN path1. *read first detail
MOVE 'C1223' TO txniddtl. *reset data
MODIFY rc2name. *update database record
PRINT trndtl. *print image
IDMS-DISCONNECT rc2name FROM rc1name. *re-assign detail group
IF IDMS-STATUS NOT = '0000' *test if ok
EXHIBIT IDMS-STATUS * -display error
ROLLBACK * -rollback updates
GOTO epilogue. * -exit
MOVE 'C1223' TO txnid. *pre set tran id
OBTAIN CALC rc1name. *read direct key on txnid
IDMS-CONNECT rc2name TO rc1name. *assign detail to new group
IF IDMS-STATUS NOT = '0000' *test if ok
EXHIBIT IDMS-STATUS * -display error
ROLLBACK * -rollback updates
GOTO epilogue. * -exit
EPILOGUE FINISH. *terminate DBMS
GOTO EOJ. *shutdown
PURPOSE: Test to see if the path specified has any record occurances.
ENVIRONMENT: IDMS data base manager only.
DESCRIPTION:
(tag) IDMS-IF (NOT) field (MEMBER) (.)
(IS EMPTY)
(IS NOT EMPTY)
SPECIAL NOTES:
Use the IDMS-STATUS to determine the results of the IDMS-IF request. A code 0000 is a true response. A 0001 is a false response to your request.
"tag" a name up to 8 characters for GOTO branching.
"field" is either a label reference to a DEFINES statement, a data value constant, or the explicit
usage of file, length, and position info (see DEFINES).
" . " will delimit an IF statement set.
SAMPLE: col 1 .....up to col 71
*****************************************************
* idms use of the IDMS-IF verb *
*****************************************************
txntype DEFAREA SIZE=100 *memory workarea
txndtl DEFAREA SIZE=220 *memory workarea
rec1work DEFINES (F=txntype,P=1,L=100) *full work size
txnid DEFINES (F=txntype,P=1,L=5) *tran id
rec2work DEFINES (F=txndtl,P=1,L=100) *full work size
amount DEFINES (F=txndtl,P=57,L=6,T=P) *amount field
db1name DEFINES 'dev5dict ' *db names must be 16 bytes
ss1name DEFINES 'intssc01 ' *schema name must be 16 bytes
rc1name DEFINES 'txntype ' *parent name - 16 bytes
rc2name DEFINES 'txndtl ' *detail name - 16 bytes
path1 DEFINES 'txntype-txndtl ' *path name - 16 bytes
ar1name DEFINES 'txn-area ' *area name - 16 bytes
start BIND RUN-UNIT FOR ss1name DBNAME db1name.*bind run unit
BIND rc1name TO rc1work. *declare rec to storage
BIND rc2name TO rc2work. *declare rec to storage
READY ar1name USAGE-MODE IS UPDATE. *update mode
MOVE 'C4123' TO txnid. *pre set tran id
OBTAIN CALC rc1name. *read direct key on txnid
IDMS-IF path1 IS NOT EMPTY *if full path
IF IDMS-STATUS = '0000' * yes-has members
ERASE path1 ALL MEMBERS. * -erase all members
EPILOGUE FINISH. *terminate DBMS
GOTO EOJ. *shutdown
PURPOSE: To return the DB KEY for the specified record.
ENVIRONMENT: IDMS data base manager only.
DESCRIPTION:
(tag) IDMS-RETURN field FROM field (CURRENCY) (.)
(FIRST)
(LAST)
(NEXT)
(PRIOR)
(USING field)
SPECIAL NOTES:
The first field is the db key and should be a 4 byte hex field.
"tag" a name up to 8 characters for GOTO branching.
"field" is either a label reference to a DEFINES statement, a data value constant, or the explicit
usage of file, length, and position info (see DEFINES).
" . " will delimit an IF statement set.
SAMPLE: col 1 .....up to col 71
*****************************************************
* idms use of the IDMS-RETURN verb *
*****************************************************
txntype DEFAREA SIZE=100 *memory workarea
txndtl DEFAREA SIZE=220 *memory workarea
rec1work DEFINES (F=txntype,P=1,L=100) *full work size
db1name DEFINES 'dev5dict ' *db names must be 16 bytes
ss1name DEFINES 'intssc01 ' *schema name must be 16 bytes
rc1name DEFINES 'txntype ' *parent name - 16 bytes
ar1name DEFINES 'txn-area ' *area name - 16 bytes
dbkeyfld DEFINES X'00000000' *dbkey field work
start BIND RUN-UNIT FOR ss1name DBNAME db1name.*bind run unit
BIND rc1name TO rc1work. *declare rec to storage
READY ar1name. *browse mode
IDMS-RETURN dbkeyfld FROM rc1name NEXT. *get next dbkey
OBTAIN rc1name DB-KEY IS dbkeyfld. *read next using the dbkey
PRINT trandtl. *print image
EPILOGUE FINISH. *terminate DBMS
GOTO EOJ. *shutdown
PURPOSE: To selectively process input files based on data or count tests.
DESCRIPTION:
(tag) IF |field | |EQUAL (TO) | |field |
|LOC OF ddname | |NOT EQUAL | |LOC OF ddname |
|VAR OF ddname | |LESS THAN | |VAR OF ddname |
|COUNTIN OF ddname | |NOT LESS | |COUNTIN OF ddname |
|COUNTOUT OF ddname | |GREATER THAN | |COUNTOUT OF ddname |
|COUNTDEL OF ddname | |NOT GREATER | |COUNTDEL OF ddname |
|RECORDSW OF ddname | | =, NOT = | |RECORDSW OF ddname |
|SCANHIT OF ddname | | <, NOT < | |SCANHIT OF ddname |
|MEMNAME OF ddname | | >, NOT > | |MEMNAME OF ddname |
|(NOT) NUMERIC |
SPECIAL NOTES:
The "IF" statement is similar to COBOL's but does not allow "ELSE" conditions or the use of connecting verbs such as "OR" or "AND". However, "AND" can be accomplished by nesting; and "OR" can be accomplished by multiple IF statements.
Nesting may be done to any number of levels. Periods will delimit the statement command group range. "IF" statements may be used only on input file record areas, (exception of tests on an output file's record count).
When a file's record is unavailable (such as at EOF, deleted via the DELETE verb, or not present via the SYNC verb), the IF command is designed to recognize this condition and skip the request.
"IF" relies on the TYPE code to determine the test conditions to perform. Character to character type compares are byte to byte tests. Mixed type tests will attempt to automatically convert the fields into a common format before testing is done. Mixed type tests do not need to be of equal lengths. For example a hex field 1 byte in length with a value of +2 will be equal to a packed field length of 6 with a value of +2. A warning message will appear on R01 for non-numeric data values, but processing will continue.
"tag" a name up to 8 characters for GOTO branching.
"field" is either a label reference to a DEFINES statement,a data value constant, or the explicit
usage of file, length, and position info (see DEFINES).
" . " will delimit an IF statement set.
"VAR" the adjustable 4 byte binary length value for LEN=VAR
"LOC" the adjustable 4 byte binary position value for POS=LOC
"COUNTIN" records in count for an input file a packed 4 bytes.
"COUNTOUT" records out count for an output file a packed 4 bytes.
"COUNTDEL" records deleted count for an input file a packed 4.
"RECORDSW" eof, rec status indicator (Y=eof, P=present, E=empty).
"SCANHIT" SCANTEST indicator (Y=hit, space=no hit).
"MEMNAME" READPDS's member name storage an 8 byte field.
SAMPLE:
*************************************
* output 100 selected records *
*************************************
mstid DEFINES (F=mstdd,L=2,P=1) *rec type loc
limit DEFINES C'100' *rec count limit
*************************************
* 100 recs, select & write *
*************************************
start READ mstdd. *read next mst
IF COUNTOUT of mstout > limit *if 100 rec written
GOTO EOJ. * Yes-stop job
IF mstid NOT NUMERIC *if type invalid
GOTO EOJ. * shut down
IF mstid EQUAL '88' *if rec type found
WRITE outmst from mstdd. * write record
GOTO start. *loop for more
PURPOSE: To selectively process input files based on data or count tests without converting
numeric field formats.
DESCRIPTION:
(tag) IF |field | |EQUAL (TO) | |field |
|LOC OF ddname | |NOT EQUAL | |LOC OF ddname |
|VAR OF ddname | |LESS THAN | |VAR OF ddname |
|COUNTIN OF ddname | |NOT LESS | |COUNTIN OF ddname |
|COUNTOUT OF ddname | |GREATER THAN | |COUNTOUT OF ddname |
|COUNTDEL OF ddname | |NOT GREATER | |COUNTDEL OF ddname |
|RECORDSW OF ddname | | =, NOT = | |RECORDSW OF ddname |
|SCANHIT OF ddname | | <, NOT < | |SCANHIT OF ddname |
|MEMNAME OF ddname | | >, NOT > | |MEMNAME OF ddname |
|(NOT) NUMERIC |
SPECIAL NOTES:
The IFX verb is identical to the IF verb except no conversions are done to numeric fields. All comparisons are done byte for byte. See IF statement for more details.
Nesting may be done to any number of levels. Periods will delimit the statement command group range. IFX statements may be used only on input file record areas, (exception of tests on an output file's record count).
When a file's record is unavailable (such as at EOF, deleted via the DELETE verb, or not present via the SYNC verb), the IF command is designed to recognize this condition and skip the request.
SAMPLE: col 1 .......up to col 71
*************************************
* skip record id 23 *
*************************************
mstid DEFINES (F=mstdd,L=2,P=1,T=P)
start READ mstdd. *read next mst
IFX mstin = X'023C' *if id is 23
GOTO start. * Yes-skip rec
WRITE outmst from mstdd. *write out record
GOTO start. *loop for more
PURPOSE: To place record locks on IDMS database records.
ENVIRONMENT: IDMS data base manager only.
DESCRIPTION:
(tag) KEEP (EXCLUSIVE) (CURRENT) (WITHIN) (AREA) field (.)
SPECIAL NOTES:
Database records released until a FINISH or COMMIT is issued. The "AREA" keyword has been added to assist Workbench in determining whether area or record name is being used in the field position.
"tag" a name up to 8 characters for GOTO branching.
"field" is either a label reference to a DEFINES statement, a data value constant, or the explicit
usage of file, length, and position info (see DEFINES).
" . " will delimit an IF statement set.
SAMPLE: col 1 .....up to col 71
*****************************************************
* idms area sweep to update records *
*****************************************************
umtcxfr DEFAREA SIZE=220 *memory workarea
rec1work DEFINES (F=umtcxfr,P=1,L=220) *full work size
acct DEFINES (F=umtcxfr,P=7,L=5) *account id
amount DEFINES (F=umtcxfr,P=57,L=6,T=P) *amount field
db1name DEFINES 'dev5dict ' *db names must be 16 bytes
ss1name DEFINES 'intssc01 ' *schema name must be 16 bytes
rc1name DEFINES 'umtcxfr ' *record name - 16 bytes
ar1name DEFINES 'pend-area ' *area name - 16 bytes
start BIND RUN-UNIT FOR ss1name DBNAME db1name.*bind run unit
BIND rc1name TO rc1work. *declare rec to storage
READY ar1name USAGE-MODE IS UPDATE. *update mode
OBTAIN FIRST rc1name WITHIN AREA ar1name.*area sweep 1st rec
loop IF IDMS-STATUS NOT = '0000' *if read failed
EXHIBIT IDMS-STATUS * yes-display
GOTO done. * -exit
IF acct = 'AU123' *if account found
PRINT umtcxfr * yes-print record
MOVE P'+00012060048' * -zap the data
KEEP EXCLUSIVE CURRENT rc1name * -lock record
MODIFY rc1name * -update the record
PRINT umtcxfr * -print after image
IF IDMS-STATUS NOT = '0000' * -test if ok
EXHIBIT IDMS-STATUS * -display error
ROLLBACK * -rollback update
GOTO done. * -exit
ADD '1' TO COUNTIN OF umtcxfr. *manually up counts
OBTAIN NEXT rc1name WITHIN AREA ar1name. *read next record
GOTO loop. *loop for more
done FINISH. *terminate DBMS
EXHIBIT '---total records---'. *display counts
EXHIBIT COUNTIN OF umtcxfr. *
GOTO EOJ. *shutdown
PURPOSE: To load and compare source code using page split facility.
DESCRIPTION:
(tag) LOADSRC ddname-in (TO ) ddname-in (EXPAND) (SIZE=nnnnn) (.)
SPECIAL NOTES:
LOADSRC will load ddname-a and ddname-b records into source code compare tables "old" vs "new" (ddname-a is old, ddname-b is new). When the desired number of records have been loaded, a COMPSRC compare request may be issued by the user. See COMPSRC for a further information.
The optional EXPAND parm is very useful to desk check the compared source code. EXPAND prints the entire old source code, allowing a more thorough check out showing which stmts matched.
The optional SIZE parameter is used to set the expected compare size and is specified in number of statements. For example, if you wish to compare a large COBOL program that has 11,430 lines of code, you would probably use SIZE=12000 and bump up your job region size. The default is 10,000 statements.
Although LOADSRC is one of a two part process to compare library member groups, it should also be used to compare a single source code set. The following example will process a single program. Files will load compare tables until both files are EOF. WORKBENCH will then process its end of job logic and automatically request a compare of the tables before files are closed and stats reported.
SAMPLE: col 1 .......up to col 71
*************************************
* source code compare *
*************************************
reads READ before. *read source
READ after. *code
LOADSRC before after. *load table
GOTO reads. *loop
PURPOSE: Will set bits to 1 if the first field "AND" the second field bits are both 1. Bits are set to
zero if they are not both equal to 1.
DESCRIPTION:
(tag) MASKAND field (TO) field (.)
SPECIAL NOTES:
MASKAND is used to set bits for up to 255 byte field sizes. Bits are processed left to right and may overlap. An example of one byte "maskand"ing another: 0001 1111 If both bytes are 1's then the result will be a 1. A mix of 1,0 gets a 0. 1110 1011
========
0000 1011
"tag" a name up to 8 characters for GOTO branching.
"field" is either a label reference to a DEFINES statement, a data value constant, or the
explicit usage of file, length, and position info (see DEFINES).
" . " will delimit an IF statement set.
SAMPLE: col 1 .......up to col 71
*************************************
* mask "and" request *
*************************************
ind1 DEFINES (F=in,P=05,L=1)
ind2 DEFINES (F=in,P=21,L=1)
start READ in. *read next mst
MASKAND ind1 TO ind2. *"and" byte
WRITE out FROM in. *output rec
GOTO start. *loop until done
PURPOSE: Will set bits to 1 if the first field "OR" the second field bits are 1. Bits are set to
zero if they are both equal to 0.
DESCRIPTION:
(tag) MASKOR field (TO) field (.)
SPECIAL NOTES:
MASKOR is used to set bits for up to 255 byte field sizes. Bits are processed left to right and may overlap. An example of one byte "maskor"ing another: 0001 1111 If either byte is 1 then the result will be a 1. 0110 1011
========
0111 1111
"tag" a name up to 8 characters for GOTO branching.
"field" is either a label reference to a DEFINES statement, a data value constant, or the
explicit usage of file, length, and position info (see DEFINES).
" . " will delimit an IF statement set.
SAMPLE: col 1 .......up to col 71
*************************************
* mask "or" request *
*************************************
amt DEFINES (F=in,P=01,L=4,T=P)
sign DEFINES (F=in,P=4,L=1)
start READ in. *read next mst
MASKOR X'0F' TO sign. *force "+" sign
WRITE out FROM in. *output rec
GOTO start. *loop until done
PURPOSE: To update database records.
ENVIRONMENT: IDMS data base manager only.
DESCRIPTION:
(tag) MODIFY field (.)
SPECIAL NOTES:
Database records replaced but not committed until a FINISH or COMMIT is issued.
"tag" a name up to 8 characters for GOTO branching.
"field" is either a label reference to a DEFINES statement, a data value constant, or the explicit
usage of file, length, and position info (see DEFINES).
" . " will delimit an IF statement set.
SAMPLE: col 1 .....up to col 71
*****************************************************
* idms area sweep to update records *
*****************************************************
umtcxfr DEFAREA SIZE=220 *memory workarea
rec1work DEFINES (F=umtcxfr,P=1,L=220) *full work size
acct DEFINES (F=umtcxfr,P=7,L=5) *account id
amount DEFINES (F=umtcxfr,P=57,L=6,T=P) *amount field
db1name DEFINES 'dev5dict ' *db names must be 16 bytes
ss1name DEFINES 'intssc01 ' *schema name must be 16 bytes
rc1name DEFINES 'umtcxfr ' *record name - 16 bytes
ar1name DEFINES 'pend-area ' *area name - 16 bytes
start BIND RUN-UNIT FOR ss1name DBNAME db1name.*bind run unit
BIND rc1name TO rc1work. *declare rec to storage
READY ar1name USAGE-MODE IS UPDATE. *update mode
OBTAIN FIRST rc1name WITHIN AREA ar1name.*area sweep 1st rec
loop IF IDMS-STATUS NOT = '0000' *if read failed
EXHIBIT IDMS-STATUS * yes-display
GOTO done. * -exit
IF acct = 'AU123' *if account found
PRINT umtcxfr * yes-print record
MOVE P'+00012060048' TO amount * -zap the data
MODIFY rc1name * -update the record
PRINT umtcxfr * -print after image
IF IDMS-STATUS NOT = '0000' * -test if ok
EXHIBIT IDMS-STATUS * -display error
ROLLBACK * -rollback update
GOTO done. * -exit
ADD '1' TO COUNTIN OF umtcxfr. *manually up counts
OBTAIN NEXT rc1name WITHIN AREA ar1name. *read next record
GOTO loop. *loop for more
done FINISH. *terminate DBMS
EXHIBIT '---total records---'. *display counts
EXHIBIT COUNTIN OF umtcxfr. *
GOTO EOJ. *shutdown
PURPOSE: To modify or build data in an input record, WORKAREA, or member name field.
DESCRIPTION:
(tag) MOVE | field | (TO) | field | (.)
|MEMNAME OF ddname| |MEMNAME OF ddname|
SPECIAL NOTES:
MOVE transfers data one byte at a time to the designated location. Maximum length of fields is 32760 bytes. The sending and receiving fields may overlap. The command is designed to bypass processing if the file record designated is not available.
"tag" a name up to 8 characters for GOTO branching.
"field" is either a label reference to a DEFINES statement, a data value constant, or the explicit
usage of file, length, and position info (see DEFINES).
"MEMNAME" READPDS's member name storage 8 byte field. Panvalet libraries have 10 byte names.
" . " will delimit an IF statement set.
SAMPLE: col 1 .......up to col 71
*************************************
* id and limit defined *
*************************************
mstid DEFINES (F=mstdd,L=2,P=1) *rec type loc
*************************************
* read and modify rec types 88 *
*************************************
start READ mstdd. *read next mst
IF mstid EQUAL '88' *if rec found
MOVE '12' TO mstid * reset type to 12
WRITE outmst FROM mstdd. * write record
GOTO start. *loop until done
PURPOSE: To modify or build data in an input record, WORKAREA, or member name field, with automatic
numeric conversion for the field types.
DESCRIPTION:
(tag) MOVEN | field | (TO) | field | (.)
|MEMNAME OF ddname| |MEMNAME OF ddname|
SPECIAL NOTES:
This verb is the same as CVTBIN, CVTDEC, or CVTCHAR in function. The difference is, MOVEN uses the receiving field type definition to determine the resulting format. The CVTBIN, CVTDEC, and CVTCHAR will force the receiving field to be in the format for the verb. For example, CVTBIN will force a binary result in the receiving field regardless of the field's definition.
MOVEN transfers data one byte at a time to the designated location. Maximum length of fields is 32760 bytes. The sending and receiving fields may overlap. The command is designed to bypass processing if the file record designated is not available.
"tag" a name up to 8 characters for GOTO branching.
"field" is either a label reference to a DEFINES statement, a data value constant, or the explicit
usage of file, length, and position info (see DEFINES).
"MEMNAME" READPDS's member name storage 8 byte field.
" . " will delimit an IF statement set.
SAMPLE: col 1 .......up to col 71
*************************************
* convert fields into various formats
*************************************
lit54 DEFINES P'+54' *packed value
amount DEFINES (F=in,P=1,L=12,T=C) *amount field
time DEFINES (F=in,P=45,L=4,T=X) *time
rdw DEFINES (F=WORKAREA,P=1,L=2,T=X)
amt DEFINES (F=WORKAREA,P=5,L=8,T=P)
tim DEFINES (F=WORKAREA,P=15,L=3,T=P)
start READ in. *read rec
MOVEN lit54 TO rdw. *load vb length
MOVEN amount TO amt. *amt convert
MOVEN time TO tim. *time convert
WRITE out FROM WORKAREA. *output rec
GOTO EOJ. *shut down
PURPOSE: To modify or build data in an input record, WORKAREA, or member name field, but
limit move area to length of record area.
DESCRIPTION:
(tag) MOVEX | field | (TO) | field | (.)
|MEMNAME OF ddname| |MEMNAME OF ddname|
SPECIAL NOTES:
MOVEX transfers data one byte at a time to the designated location. Maximum length of fields is 32760 bytes. The sending and receiving fields may overlap. The command is designed to bypass processing if the file record designated is not available.
The difference between MOVEX and MOVE is that MOVEX stops its process if the end of the record has been detected. MOVE on the other hand does not restrict the end of the record, but is driven by the requested length size.
"tag" a name up to 8 characters for GOTO branching.
"field" is either a label reference to a DEFINES statement, a data value constant, or the explicit
usage of file, length, and position info (see DEFINES).
"MEMNAME" READPDS's member name storage 8 byte field.
" . " will delimit an IF statement set.
SAMPLE: col 1 .......up to col 71
*************************************
* read a vb file and output records *
*************************************
inrec DEFINES (F=mstdd,P=1,L=100) *vb rec area
outrec DEFINES (F=WORKAREA,P=1,L=100) *wk area
start READ mstdd. *read next mst
MOVE ' ' TO recarea. *if rec found
MOVEX inrec TO recarea. *
WRITE outmst FROM WORKAREA. * write record
GOTO start. *loop until done
PURPOSE: To mathmatically multiply one number by another.
DESCRIPTION:
(tag) MULTIPLY field (BY) field (.)
SPECIAL NOTES:
MULTIPLY will multiply the value in the first operand by the value of the second operand. Field type is checked and automatically converted to the receiving field's numeric type. The first operand field size must be large enough to accomodate the resulting value.
Numeric types are character display, packed decimal, and binary. Character types have maximum size of 31 bytes, Packed fields have limits of 31 digits (16 bytes), and binary fields have limits of 4 bytes binary. Max binary numeric value is 134,217,727 or hex '07FFFFFF'.
"tag" a name up to 8 characters for GOTO branching and is optional..
"field" is either a label reference to a DEFINES statement, a data value constant, or the
explicit usage of file, length, and position info (see DEFINES).
" . " will delimit an IF statement set and is optional.
SAMPLE: column 1 .......up to col 71
*************************************
* read and calc billed amounts *
*************************************
billed DEFINES (F=mstdd,P=1,L=10,T=P) *amt field
start READ mstdd. *read next mst
MULTIPLY billed by '12'. *compute annual amt
EXHIBIT billed. *display amount
GOTO start. *loop until done
PURPOSE: To read an IDMS database record.
ENVIRONMENT: IDMS only
DESCRIPTION:
Format 1.
(tag) OBTAIN (KEEP) (EXCLUSIVE) (FIRST) field (WITHIN) (AREA) field (.)
(LAST)
(PRIOR)
(NEXT)
Format 2.
(tag) OBTAIN (KEEP) (EXCLUSIVE) (CURRENT) WITHIN (AREA) field (.)
(FIRST)
(LAST)
(NEXT)
(PRIOR)
(OWNER)
(DBKEY)
(DUPLICATE)
Other formats:
(tag) OBTAIN (KEEP) (EXCLUSIVE) field DB-KEY IS field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) field WITHIN field CURRENT USING field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) field field WITHIN (AREA) field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) CALC (ANY) field (.)
SPECIAL NOTES:
OBTAIN is the verb to access IDMS database records. The method used by Workbench is through native DML calls similar to the normal COBOL language syntax. Statement is as close as possible to IDMS's DML syntax. The exceptions are in the use of the "AREA" keyword to help Workbench determine record vs. area access. Another example is the use of IDMS "IF" and "RETURN" which conflicts with Workbench's "IF" and "RETURN". In these situations, we have changed the syntax to be IDMS-IF and IDMS- RETURN. A list of all possible Workbench IDMS OBTAIN commands follow the sample.
Field refers to a record name, db-key value, or record number. Syntax of the call to IDMS required the field to be exactly 16 byte name sizes. Any less, you will not get your record. We are aware of this limitation but to maintain the maximum flexibility and compatibility with a third party vendor, the situtation exists. Mechanically, Workbench builds a call list to IDMS, exactly the way the IDMS pre-compiler does. We substitue our Workbench variables in place of the "field" values passed to IDMS.
"tag" a name up to 8 characters for GOTO branching.
"field" is either a label reference to a DEFINES statement, a data value constant, or the explicit
usage of file, length, and position info (see DEFINES).
" . " will delimit an IF statement set.
SAMPLE: col 1 .....up to col 71
*****************************************************
* idms area sweep to dump out records *
*****************************************************
umtcxfr DEFAREA SIZE=220 *memory workarea
rec1work DEFINES (F=umtcxfr,P=1,L=220) *full work size
db1name DEFINES 'dev5dict ' *db names must be 16 bytes
ss1name DEFINES 'intssc01 ' *schema name must be 16 bytes
rc1name DEFINES 'umtcxfr ' *record name - 16 bytes
ar1name DEFINES 'pend-area ' *area name - 16 bytes
start BIND RUN-UNIT FOR ss1name DBNAME db1name. *bind run unit
BIND rc1name TO rc1work. *declare rec to storage
READY ar1name USAGE-MODE IS RETRIEVAL. *read only mode
OBTAIN FIRST rc1name WITHIN AREA ar1name. *area sweep 1st rec
loop IF IDMS-STATUS NOT = '0000' *if read failed
EXHIBIT IDMS-STATUS * yes-display
GOTO done. * -exit
ADD '1' TO COUNTIN OF umtcxfr. *manually up counts
PRINT umtcxfr. *print record
DUMP umtcxfr. *dump record
OBTAIN NEXT rc1name WITHIN AREA ar1name. *read next record
GOTO loop. *loop for more
done FINISH. *terminate DBMS
EXHIBIT '---total records---'. *display counts
EXHIBIT COUNTIN OF umtcxfr. *
GOTO EOJ. *shutdown
PROCESS:
*The DEFAREA creates a buffer area to receive the database record.
*Connect to IDMS by binding the run-unit to the database and DML subschema.
LRF subschemas are not supported.
*Indicate where the record is to be stored.
*READY the area in read mode or update mode.
*Print and dump all records.
*When the status is not zeros, disconnect from IDMS with the FINISH verb and terminate the
task by using GOTO EOJ.
The following is a complete list of IDMS OBTAIN and FIND verbs supported. The KEEP and EXCLUSIVE keywords are optional as is the "tag" and "." period to delimit IF statements. For FIND verbs, use the keyword FIND instead of OBTAIN.
(tag) OBTAIN (KEEP) (EXCLUSIVE) FIRST field WITHIN AREA field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) LAST field WITHIN AREA field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) NEXT field WITHIN AREA field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) PRIOR field WITHIN AREA field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) FIRST field WITHIN field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) LAST field WITHIN field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) NEXT field WITHIN field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) PRIOR field WITHIN field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) field DB-KEY IS field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) field WITHIN AREA field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) field WITHIN field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) field WITHIN field CURRENT USING field
(tag) OBTAIN (KEEP) (EXCLUSIVE) field WITHIN field USING field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) field field WITHIN AREA field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) field field WITHIN field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) CALC ANY field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) CALC field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) CURRENT WITHIN AREA field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) FIRST WITHIN AREA field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) LAST WITHIN AREA field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) NEXT WITHIN AREA field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) PRIOR WITHIN AREA field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) DB-KEY field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) DUPLICATE field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) CURRENT WITHIN field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) FIRST WITHIN field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) LAST WITHIN field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) NEXT WITHIN field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) PRIOR WITHIN field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) OWNER WITHIN field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) CURRENT field (.)
(tag) OBTAIN (KEEP) (EXCLUSIVE) CURRENT (.)
PURPOSE: To move a character display numeric field to a packed decimal format field.
DESCRIPTION:
(tag) PACK field (TO) field (.)
SPECIAL NOTES:
PACK converts a numeric field to the packed format. CVTDEC verb will also accomplishes the same request.
Operation maximum is 31 digits or 16 byte packed field. Receiving field's TYPE definition is automatically set to Packed for this operation.
"tag" a name up to 8 characters for GOTO branching.
"field" is either a label reference to a DEFINES statement, a data value constant, or the explicit
usage of file, length, and position info (see DEFINES).
" . " will delimit an IF statement set.
SAMPLE: col 1 .......up to col 71
*************************************
* pack amount field *
*************************************
amt DEFINES C'123456789'
amtp DEFINES (F=in,P=1,L=5)
start READ in. *read next mst
PACK amt TO amtp. *pack amt
WRITE out FROM in. *output rec
GOTO start. *loop until done
PURPOSE: To call a subroutine defined within the Workbench command verbs.
DESCRIPTION:
(tag) PERFORM | tag | (.)
SPECIAL NOTES:
PERFORM will branch to another command statement as requested and save the return address in a 100 entry address stack.
Stack entries are added in first-in-first out order. The RETURN verb will use this stack to branch control back to the next command following the PERFORM. Performs, therefore, can be nested 100 levels. If you get the message that you exceeded your stack limit, there is most likely an error in your logic. You are probably performing a routine and issuing a GOTO out of it instead of a RETURN.
"tag" a name up to 8 characters for GOTO branching.
" . " will delimit an IF statement set.
SAMPLE: col 1 .......up to col 71
*************************************
* read, select, convert fld, write *
*************************************
mstid DEFINES (F=mstdd,L=2,P=1) *rec type loc
amt DEFINES (F=mstdd,L=3,P=5,T=P) *rec amt fld
amtnew DEFINES (F=mstdd,L=5,P=14) *total amount
start READ mstdd. *read next mst
IF mstid EQUAL '18' *if rec type found
PERFORM outrec. * select rec
IF mstid EQUAL '25' *if rec type found
PERFORM outrec. * select rec
IF mstid EQUAL '53' *if rec type found
PERFORM outrec. * select rec
GOTO start. *loop for more
outrec PRINT mstdd. *print it
CVTCHAR amt TO amtnew. *convert field
WRITE mstout FROM msgdd. *write record
RETURN. *exit
PURPOSE: To character print records in 100 byte print lines.
DESCRIPTION:
(tag) PRINT ddname-in (.)
SPECIAL NOTES:
The PRINT command initiates report R02 for output displays. Data set name, volume serial number, create date, and other report title information are automatically printed.
"tag" a name up to 8 characters for GOTO branching.
"ddname" is the input file name of the record to printed.
" . " will delimit an IF statement set.
SAMPLE: col 1 .......up to col 71
*************************************
* id, number, defined *
*************************************
mstid DEFINES (F=mstdd,L=2,P=1) *rec type loc
mstnum DEFINES (F=mstdd,L=5,P=5) *rec number loc
*************************************
* print all but 12345 *
*************************************
start READ mstdd. *read next mst
IF mstnum EQUAL '12345' *if rec
DELETE mstdd. * skip it
PRINT mstdd. *print record
GOTO start. *loop until done
PURPOSE: To read a logical record.
DESCRIPTION:
(tag) READ ddname-in (.)
SPECIAL NOTES:
The input file ddname specified will receive all needed attributes from the system catalog or JCL.
Up to 99 files may be processed in a single job. Input files may be QSAM, VSAM, or ISAM; either variable or fixed record formats. Process will automatically terminate when all input files have reached EOF.
When a file's record is unavailable (such as at EOF, deleted via the DELETE verb, or not present via the SYNC verb), all process request verbs are designed to recognize this condition and skip that process. This allows a convenient and simplified language set.
"tag" is a name up to 8 characters for GOTO branching.
"ddname" is the input file name assigned in the execute JCL.
"." is a period that ends an IF statement group.
SAMPLE: col 1 .......up to col 71
*************************************
* read and copy three files *
*************************************
start READ mstdd. *read next mst
READ txndd. *read trans
READ mtdtxn. *read mtd txns
WRITE outmst FROM mstdd. *copy mst
WRITE outtxn FROM txndd. *copy txn file
WRITE outmtd FROM mtdtxn. *copy mtd file
GOTO start. *loop
PURPOSE: To request a logical record read from a Librarian file.
DESCRIPTION:
(tag) READLIB ddname-in (FOR) member-name (CODE=xxxx) (.)
******** *=any char substituted
SPECIAL NOTES:
Librarian file processing is performed as read only.
Up to 99 files may be processed in a single job. Input files must be Librarian files (80 and 132 byte formats). Process will automatically terminate when all input files have reached EOF on all members requested.
Member names may be tested, stored, or altered by using the special access "MEMNAME OF ddname- in". MEMNAME is 8 characters.
When a file's record is unavailable (such as at EOF, deleted via the DELETE verb, or not present via the SYNC verb), all process request verbs are designed to recognize this condition and skip that process. This allows a convenient and simplified language set.
"tag" is a name up to 8 characters for GOTO branching.
"ddname" is the input file name assigned in the execute JCL.
"member" is the specific member name or member group.
"CODE=' is the 4 byte Librarian management code for secured members.
"." is a period that ends a conditional set of statements.
SAMPLE: col 1 .......up to col 71
********************************************
* scan mastin for values *
********************************************
start READLIB mastin FOR pac***** CODE=1208
SCAN mastin FOR 'prn'.
SCAN mastin FOR 'pro'.
GOTO start.
PURPOSE: To request a logical record read from a PANVALET file.
DESCRIPTION:
(tag) READPAN ddname-in (FOR) member-name (.)
********** *=any char substituted
SPECIAL NOTES:
Panvalet processing is performed without enqueing the library which avoids locking out other users.
Up to 99 files may be processed in a single job. Input files must be a Panvalet Library (80 byte only). Process will automatically terminate when all input files have reached EOF on all members requested.
Member names may be tested, stored, or altered by using the special access "MEMNAME OF ddname- in". MEMNAME is 10 characters.
When a file's record is unavailable (such as at EOF, deleted via the DELETE verb, or not present via the SYNC verb), all process request verbs are designed to recognize this condition and skip that process. This allows a convenient and simplified language set.
"tag" is a name up to 8 characters for GOTO branching.
"ddname" is the input file name assigned in the execute JCL.
"member" is the specific member name or member group.
"." is a period that ends a conditional set of statements.
SAMPLE: col 1 .......up to col 71
**************************************
* scan panlib for PAC modules *
**************************************
start READPAN panlib FOR pac******* *get pac
SCAN panlib FOR 'prn'. *look for PRN
SCAN panlib FOR 'pro'. *look for pro
GOTO start. * loop
PURPOSE: To request a logical record read from a PDS file.
DESCRIPTION:
(tag) READPDS ddname-in (FOR) member-name (.)
******** *=any char substituted
SPECIAL NOTES:
The input file ddname specified will receive all needed attributes from the system catalog or JCL.
Up to 99 files may be processed in a single job. Input files must be Partitioned files (fixed or variable formats). Process will automatically terminate when all input files have reached EOF on all members requested.
It is recommended that input and output files not use the same dataset. This will alter the original input.
Member names may be tested, stored, or altered by using the special access "MEMNAME OF ddname- in". MEMNAME is 8 characters.
"tag" is a name up to 8 characters for GOTO branching.
"ddname" is the input file name assigned in the execute JCL.
"member" is the specific member name or member group.
"." is a period that ends a conditional set of statements.
SAMPLE: col 1.......up to col 71
********************************************
* copy all "PAC" members except PAC900 *
********************************************
start READPDS procin FOR pac***** *get pac
IF MEMNAME OF procin = 'pac900 ' *if PAC900
DELETE procin. * yes-skip
WRITEPDS procout FROM procin. * write
GOTO start. * loop
PURPOSE: To define resources required by the IDMS task.
ENVIRONMENT: IDMS data base manager only.
DESCRIPTION:
Format 1.
(tag) READY (field) USAGE-MODE IS (EXCLUSIVE) (RETRIEVAL) (.)
(PROTECTED) (UPDATE)
Format 2.
(tag) READY (field) (.)
SPECIAL NOTES:
READY is the verb to declare IDMS database records. The method used by Workbench is through native DML calls similar to the normal COBOL language syntax. Statement is as close as possible to IDMS's DML syntax. The exceptions are in the use of the "AREA" keyword to help Workbench determine record vs area access. Another example is the
"tag" a name up to 8 characters for GOTO branching.
"field" is either a label reference to a DEFINES statement, a data value constant, or the explicit
usage of file, length, and position info (see DEFINES).
" . " will delimit an IF statement set.
SAMPLE: col 1 .....up to col 71
*****************************************************
* idms area sweep to dump out records *
*****************************************************
umtcxfr DEFAREA SIZE=220 *memory workarea
rec1work DEFINES (F=umtcxfr,P=1,L=220) *full work size
db1name DEFINES 'dev5dict ' *db names must be 16 bytes
ss1name DEFINES 'intssc01 ' *schema name must be 16 bytes
rc1name DEFINES 'umtcxfr ' *record name - 16 bytes
ar1name DEFINES 'pend-area ' *area name - 16 bytes
start BIND RUN-UNIT FOR ss1name DBNAME db1name.*bind run unit
BIND rc1name TO rc1work. *declare rec to storage
READY ar1name USAGE-MODE IS RETRIEVAL. *read only mode
OBTAIN FIRST rc1name WITHIN AREA ar1name.*area sweep 1st rec
loop IF IDMS-STATUS NOT = '0000' *if read failed
EXHIBIT IDMS-STATUS * yes-display
GOTO done. * -exit
ADD '1' TO COUNTIN OF umtcxfr. *manually up counts
PRINT umtcxfr. *print record
DUMP umtcxfr. *dump record
OBTAIN NEXT rc1name WITHIN AREA ar1name. *read next record
GOTO loop. *loop for more
done FINISH. *terminate DBMS
EXHIBIT '---total records---'. *display counts
EXHIBIT COUNTIN OF umtcxfr. *
GOTO EOJ. *shutdown
PURPOSE: To reset a file to its beginning record.
DESCRIPTION:
(tag) RESTART ddname-in (.)
SPECIAL NOTES:
RESTART will close and then re-open the file setting record counts to zero. This verb is useful for processing a given file multiple times based on a control file.
For PDS, Librarian, and Panvalet files the member list will restart to the first member and first record.
"tag" a name up to 8 characters for GOTO branching.
"ddname-in" is the input ddname to be closed & re-opened
" . " will delimit an IF statement set.
SAMPLE: col 1 .......up to col 71
*************************************
* unpack amount field *
*************************************
pgmctl DEFINES (F=ctl,P=1,L=8)
pgm DEFINES (F=in,P=LOC,L=8)
loop1 READ ctl.
loop2 READ in. *read next
IF RECORDSW OF in = 'Y' *IF EOF
RESTART in * restart file
GOTO loop1. * next ctl
SCANTEST in FOR 'xxxxxxxx'. *scan replace
IF SCANHIT OF in = 'Y' * pgm
MOVE pgmctl TO PGM. *
WRITE out FROM in. *output rec
GOTO loop2. *loop until done
PURPOSE: To exit a performed subroutine defined within the Workbench command verbs.
DESCRIPTION:
(tag) RETURN (.)
SPECIAL NOTES:
RETURN loads and branches to the return address stored in the 100 entry address stack. The address stack is built by the PERFORM verb.
Stack entries are added in first-in-first out order. The RETURN verb will use this stack to branch control back to the next command following the PERFORM. Performs, therefore, can be nested 100 levels.
There isn`t a POP verb to manipulate the stack, so please use a straight forward programming techniques of returning from called routines instead of branching out of them.
" . " will delimit an IF statement set.
SAMPLE:
*************************************
* read, select records *
*************************************
mstid DEFINES (F=mstdd,L=2,P=1) *rec type loc
amt DEFINES (F=mstdd,L=3,P=5,T=P) *rec amt fld
amtnew DEFINES (F=mstdd,L=5,P=14) *total amount
start READ mstdd. *read next mst
IF mstid EQUAL '18' *if rec type found
PERFORM outrec. * select rec
IF mstid EQUAL '25' *if rec type found
PERFORM outrec. * select rec
IF mstid EQUAL '53' *if rec type found
PERFORM outrec. * select rec
GOTO start. *loop for more
outrec PRINT mstdd. *print it
CVTCHAR amt TO amtnew. *convert field
WRITE mstout FROM msgdd. *write record
RETURN. *exit
PURPOSE: To un-do database record updates done up until the last commit point.
ENVIRONMENT: IDMS data base manager only.
DESCRIPTION:
(tag) ROLLBACK (CONTINUE) (.)
"tag" a name up to 8 characters for GOTO branching.
" . " will delimit an IF statement set.
SAMPLE: col 1 .....up to col 71
*****************************************************
* idms area sweep to delete records *
*****************************************************
umtcxfr DEFAREA SIZE=220 *memory workarea
rec1work DEFINES (F=umtcxfr,P=1,L=220) *full work size
acct DEFINES (F=umtcxfr,P=7,L=5) *account id
db1name DEFINES 'dev5dict ' *db names must be 16 bytes
ss1name DEFINES 'intssc01 ' *schema name must be 16 bytes
rc1name DEFINES 'umtcxfr ' *record name - 16 bytes
ar1name DEFINES 'pend-area ' *area name - 16 bytes
start BIND RUN-UNIT FOR ss1name DBNAME db1name.*bind run unit
BIND rc1name TO rc1work. *declare rec to storage
READY ar1name USAGE-MODE IS UPDATE. *update mode
OBTAIN FIRST rc1name WITHIN AREA ar1name.*area sweep 1st rec
loop IF IDMS-STATUS NOT = '0000' *if read failed
EXHIBIT IDMS-STATUS * yes-display
GOTO done. * -exit
IF acct = 'AU123' *if account found
PRINT umtcxfr * yes-print record
ERASE rc1name * -delete the record
IF IDMS-STATUS NOT = '0000' * -test if ok
EXHIBIT IDMS-STATUS * -display error
ROLLBACK * -rollback update
GOTO done. * -exit
ADD '1' TO COUNTIN OF umtcxfr. *manually up counts
OBTAIN NEXT rc1name WITHIN AREA ar1name. *read next record
GOTO loop. *loop for more
done FINISH. *terminate DBMS
EXHIBIT '---total records---'. *display counts
EXHIBIT COUNTIN OF umtcxfr. *
GOTO EOJ. *shutdown
PURPOSE: To search for a designated value on a record and print the record on BENCHR02 report file.
DESCRIPTION:
(tag) SCAN ddname-in FOR field (.)
SPECIAL NOTES:
SCAN command will search the input record for a value either char, hex, or packed. When a record is found with the scan value, the record will print on R02 "print" report.
"tag" a name up to 8 characters for GOTO branching.
"ddname" is the input file name of the record to scan.
"field" is either a label reference to a DEFINES statement, a data value constant, or the explicit
usage of file, length, and position info (see DEFINES).
" . " will delimit an IF statement set.
SAMPLE: col 1 .......up to col 71
*************************************
* literal storage *
*************************************
mstname DEFINES C'XYZ' *name
*************************************
* read and scan records *
*************************************
start READ mstdd. *read next mst
SCAN mstdd FOR mstname. *scan for name
SCAN mstdd FOR C'ABCDE'. *scan for value
SCAN mstdd FOR X'0004F3'. *scan for value
SCAN mstdd FOR P'+12345'. *scan for value
GOTO start. *loop until done
PURPOSE: To search for a designated value on a record and set a location pointer.
DESCRIPTION:
(tag) SCANSTEP ddname-in FOR field (.)
SPECIAL NOTES:
This command will search the input record for a value either char, hex, or packed. When a record is found with the scan value, an indicator (SCANHIT) and a location pointer will be set. The location pointer may be referenced using the explicit format (see DEFINES).
The difference between SCANSTEP AND SCANTEST is that the SCANTEST always begins its search from record position 1. SCANSTEP begins its search at the current location pointer to allow the users to "step" through a given record.
"tag" a name up to 8 characters for GOTO branching.
"ddname" is the input file name of the record to scan.
"field" is either a label reference to a DEFINES statement, a data value constant, or the explicit
usage of file, length, and position info (see DEFINES).
" . " will delimit an IF statement set.
SAMPLE:
//STEP1 EXEC BENCH
//FILEIN DD *
12 34 12 43 12 12 12 12 12 12
12 34 12 43 12 12 12 12 12 12 12
//SYSIN DD *
*************************************
* scanstep *
*************************************
fld01 DEFINES (F=filein,P=LOC,L=2)
loop READ filein. *
SCANSTEP filein FOR '43'. *skip to middle
lop2 SCANSTEP filein FOR '12' *
IF SCANHIT OF filein = 'Y' *search and
MOVE '88' TO fld01 *replace
PRINT filein *
GOTO lop2. *loop
GOTO loop. *
PURPOSE: To search for a designated value on a record and set a location pointer.
DESCRIPTION:
(tag) SCANTEST ddname-in FOR field (.)
SPECIAL NOTES:
This command will search the input record for a value either char, hex, or packed. When a record is found with the scan value, an indicator (SCANHIT) and a location pointer will be set. The location pointer may be referenced using the explicit format (see DEFINES).
Modification is also allowed to the LOC field by adding, subtracting or moving. Please note, the LOC of ddname field is a binary 4 bytes. MOVES must be done in hex X'00000001' or use the CVTBIN verb such as CVTBIN '1' TO LOC of filein to set a constant.
"tag" a name up to 8 characters for GOTO branching.
"ddname" is the input file name of the record to scan.
"field" is either a label reference to a DEFINES statement, a data value constant, or the explicit
usage of file, length, and position info (see DEFINES).
" . " will delimit an IF statement set.
SAMPLE:
*************************************
* literal storage *
*************************************
mstname DEFINES C'XYZ' *name
newname DEFINES C'ABC' *new name
movenam DEFINES (F=mstdd,L=3,P=LOC) *replace loc
start READ mstdd. *read next mst
SCANTEST mstdd FOR mstname. *scan for name
IF SCANHIT OF mstdd = 'Y' *scan for value
PRINT mstdd *print before
MOVE newname TO movenam *replace one loc
PRINT mstdd. *print after
WRITE mstout FROM mstdd. *copy file
GOTO start. *loop
PURPOSE: To verify the correct spelling of words.
DESCRIPTION:
(tag) SPELL ddname-in (.)
SPECIAL NOTES:
SPELL separates the given file record into words ignoring special characters and numeric values. A dictionary look up of each word is then done. Words not found in the dictionary are displayed on report R01.
WORKBENCH's dictionary has an effective range of 50,000 words with all of its prefix, suffix and root word combinations. Maximum word size is 30 characters. An optional user dictionary is allowed by specifying the ddname BENCHWRD. The user dictionary must be one word per record with a DCB of LRECL=34, RECFM=VB,BLKSIZE=any.
Spelling check facilities by their nature have limitation that the user must be aware. WORKBENCH relies on the following assumptions:
1. Sentence structure and punctuation is not verified.
2. Word usage is not validated.
3. Words are hashed numerically to find a matching entry
4. If the word given fails, a prefix is attempted to be stripped and rechecked. If the prefix look up fails,
up to three suffixes are stripped to find an entry.
Acceptance of misspelled words are possible with the above assumptions.
"tag" a name up to 8 characters for GOTO branching.
"ddname-in" is the input ddname to be checked.
" . " will delimit an IF statement set.
SAMPLE:
*************************************
* check spelling of pgm documentation
*************************************
loop READ in. *read next
SPELL in. *check spelling
GOTO loop. *loop until done
PURPOSE: Add records to the database.
ENVIRONMENT: IDMS data base manager only.
DESCRIPTION:
(tag) STORE field (.)
SPECIAL NOTES:
Database records inserted but not committed until a FINISH or COMMIT is issued.
"tag" a name up to 8 characters for GOTO branching.
"field" is either a label reference to a DEFINES statement, a data value constant, or the explicit
usage of file, length, and position info (see DEFINES).
" . " will delimit an IF statement set.
SAMPLE: col 1 .....up to col 71
*****************************************************
* idms insert transactions under a given tran type *
*****************************************************
txntype DEFAREA SIZE=100 *memory workarea
txndtl DEFAREA SIZE=220 *memory workarea
rec1work DEFINES (F=txntype,P=1,L=100) *full work size
txnid DEFINES (F=txntype,P=1,L=5) *tran id
extract DEFINES (F=filein,P=1,L=100) *flat file extracts
rec2work DEFINES (F=txndtl,P=1,L=100) *full work size
amount DEFINES (F=txndtl,P=57,L=6,T=P) *amount field
db1name DEFINES 'dev5dict ' *db names must be 16 bytes
ss1name DEFINES 'intssc01 ' *schema name must be 16 bytes
rc1name DEFINES 'txntype ' *parent name - 16 bytes
rc2name DEFINES 'txndtl ' *detail name - 16 bytes
path1 DEFINES 'txntype-txndtl ' *path name - 16 bytes
ar1name DEFINES 'txn-area ' *area name - 16 bytes
start BIND RUN-UNIT FOR ss1name DBNAME db1name.*bind run unit
BIND rc1name TO rc1work. *declare rec to storage
BIND rc2name TO rc2work. *declare rec to storage
READY ar1name USAGE-MODE IS UPDATE. *update mode
MOVE 'C4123' TO txnid. *pre set tran id
OBTAIN CALC rc1name. *read direct key on txnid
loop IF IDMS-STATUS NOT = '0000' *if read failed
EXHIBIT IDMS-STATUS * yes-display
GOTO done. * -exit
READ filein. *read flat file of extracts
MOVE extract TO rc2work. *load data to work
STORE rc2name. *insert database record
PRINT trandtl. *print image
IF IDMS-STATUS NOT = '0000' *test if ok
EXHIBIT IDMS-STATUS * -display error
ROLLBACK * -rollback updates
GOTO epilogue. * -exit
ADD '1' TO COUNTIN OF umtcxfr. *manually up counts
GOTO loop. *loop for more
EPILOGUE FINISH. *terminate DBMS
GOTO EOJ. *shutdown
PURPOSE: To combine several fields into a single field separated by a delimiter.
DESCRIPTION:
(tag) STRING field, ....field INTO field
DELIMITED BY field (-) (.)
SPECIAL NOTES:
The STRING verb is used to group fields into a single field. The delimiter is used to locate the end of each individual field. It does not transfer the delimiter to the receiving field just like COBOL's method. Usually a comma or space is used as the delimiter, but any sized delimiter is accepted.
Should a receiving field be to small to receive the string, truncation will result.
"tag" a name up to 8 characters for GOTO branching.
"field" is either a label reference to a DEFINES statement, a data value constant, or the explicit
usage of file, length, and position info (see DEFINES).
" . " will delimit an IF statement set.
SAMPLE: col 1 .......up to col 71
*************************************
* string a character field *
*************************************
flda DEFINES C'this, ' *
fldb DEFINES C'will, ' *
fldc DEFINES C'combine, ' *
fldr DEFINES (F=in,P=1,L=30) *receiving fld
result DEFINES C'thiswillcombine' *the end result
start READ in. *read text rec
STRING flda - *string fields
fldb - *
fldc INTO fldr - *
DELIMITED BY ','. *
WRITE out FROM in. *output prec
GOTO start. *get more
PURPOSE: To subtract values from a field.
DESCRIPTION:
(tag) SUBTRACT field (FROM) field (.)
SPECIAL NOTES:
SUBTRACT reduces the value of the second operand by the value in the first operand. Field type is checked and automatically converted to the second operand's numerical type. Numeric types are Character display, Packed decimal, and binary. Character types have maximum size of 31 bytes, Packed fields have limits of 31 digits, and binary fields have limits of 4 bytes binary.
Numeric validity checking is done prior to function. An error message appears on R01 for invalid numeric data found, but processing will continue.
"tag" a name up to 8 characters for GOTO branching.
"field" is either a label reference to a DEFINES statement, a data value constant, or the explicit
usage of file, length, and position info (see DEFINES).
" . " will delimit an IF statement set.
SAMPLE: col 1 .......up to col 71
*************************************
* read and subtract billed amounts *
*************************************
billed DEFINES (F=in,P=1,L=6,T=P) *
ytd DEFINES (F=in,P=10,L=4,T=X) *
start READ in. *read next
SUBTRACT billed FROM ytd. *reduce billed
EXHIBIT ytd. *display ytd
GOTO start. *loop until done
PURPOSE: To provide a special read process that matches keys on two or more files.
DESCRIPTION:
(tag) SYNC field1 .... field99 (-) (.)
SPECIAL NOTES:
Up to 99 files may be processed in a single job. Input files may be QSAM, VSAM, or ISAM either variable or fixed record formats. Process will automatically terminate when all input files have reached EOF.
Each iteration of this command examines the next unused record on each file. It then makes available the record with the lowest key and any other record whose key matches the selected low key. The result is a matched group of records.
SYNC requires that all input files be pre-sorted by ascending key. Records will be read and marked as "present" (RECORDSW = "P") to allow process verbs to execute for those records with equal keys. Explicit format must be used to define keys and files used.
Keys must be of like data formats. No conversion is done. Lessons 4 & 5 discuss this process in detail.
"tag" a name up to 8 characters for GOTO branching.
"field" is either a label reference to a DEFINES statement, a data value constant, or the explicit
usage of file, length, and position info (see DEFINES).
" - " allows continuation for the 99 possible files.
" . " will delimit an IF statement set.
SAMPLE: col 1 .......up to col 71
*************************************
* define files and key to sync *
*************************************
mstnum DEFINES (F=mstdd,L=4,P=2) *file key loc
txnnum DEFINES (F=txndd,L=4,P=9) *trans file key
mtdnum DEFINES (F=mtddd,L=4,P=2) *mtd file key
*************************************
* select test data from prod files *
* when num is found on mst, txn, *
* & mtd files *
*************************************
start SYNC mstnum - *match all file
txnnum - *
mtdnum. *
IF mstnum EQUAL txnnum *if statement will
IF mstnum EQUAL mtdnum *prevent the write
WRITE outmst FROM mstdd *stmt from executing
WRITE outtxn FROM txndd *unless all files
WRITE outmtd FROM mtddd.*have a match
GOTO start. *sync next set
PURPOSE: To move a packed decimal field into a character display format field.
DESCRIPTION:
(tag) UNPACK field (TO) field (.)
SPECIAL NOTES:
UNPACK converts a packed field into a character display field format. This verb differs from the CVTCHAR verb by leaving the sign byte as-is (i.e. hex '012345C' would convert to hex 'F0F1F2F3F4C5'). The CVTCHAR will set the last byt to F5.
Operation maximum is 31 digits or a 16 byte packed field.
"tag" a name up to 8 characters for GOTO branching.
"field" is either a label reference to a DEFINES statement, a data value constant, or the explicit
usage of file, length, and position info (see DEFINES).
" . " will delimit an IF statement set.
SAMPLE: col 1 .......up to col 71
*************************************
* unpack amount field *
*************************************
amt DEFINES P'+1234567'
amtc DEFINES (F=in,P=1,L=7)
start READ in. *read next mst
UNPACK amt TO amtc. *pack amt
WRITE out FROM in. *output rec
GOTO start. *loop until done
PURPOSE: To separate a group of characters into several fields depending on a delimiter.
DESCRIPTION:
(tag) UNSTRING field DELIMITED BY field
INTO field, .....field (-) (.)
SPECIAL NOTES:
The UNSTRING verb is used to break up a string of characters and separate them into individual fields. Usually a comma or spaces is used as the delimiter, but any delimiter field is accepted.
Should a receiving field be to small to contain the separated string, truncation will result.
"tag" a name up to 8 characters for GOTO branching.
"field" is either a label reference to a DEFINES statement, a data value constant, or the explicit
usage of file, length, and position info (see DEFINES).
" . " will delimit an IF statement set.
SAMPLE: col 1 .......up to col 71
*************************************
* unstring a character field *
*************************************
fldx DEFINES C'this, will, separate' *
flda DEFINES (F=in,P=1,L=8) *this
fldb DEFINES (F=in,P=10,L=8) *will
fldc DEFINES (F=in,P=20,L=8) *separate
start READ in. *
UNSTRING fldx DELIMITED BY ',' - *divide
INTO - * &
flda - *separate
fldb - *
fldc.
WRITE out FROM in. *output rec
GOTO start. *loop for more
PURPOSE: To request a logical record write.
DESCRIPTION:
(tag) WRITE ddname-out (FROM) ddname-in (.)
SPECIAL NOTES:
Up to 99 files may be processed in a single job. Output files must be QSAM variable or fixed record formats. Size and format of the output record may be different from the input file's format. Formats are controlled by DCB information provided in the user's JCL.
When a file's record is unavailable (such as at EOF, deleted via the DELETE verb, or not present via the SYNC verb), the WRITE command is designed to recognize this condition and skip the request.
"tag" a name up to 8 characters for GOTO branching.
"ddname-out" is the output file to be written.
"ddname-in" is the input file to use as a source.
" . " Periods are COBOL like delimiters that end the IF.
SAMPLE: col 1 .......up to col 71
*************************************
* read and copy three files *
*************************************
start READ mstdd. *read next mst
READ txndd. *read trans
READ mtdtxn. *read mtd txns
WRITE outmst FROM mstdd. *copy mst
WRITE outtxn FROM txndd. *copy txn
WRITE outmtd FROM mtdtxn. *copy mtd
GOTO start. *loop for more
PURPOSE: To request a logical record write for a PDS member.
DESCRIPTION:
(tag) WRITEPDS ddname-out (FROM) ddname-in (.)
SPECIAL NOTES:
Up to 99 files may be processed in a single job. There is no limit to the number of members processed. FB or VB files may be written out. The member name stored in the output's directory is the same as the input file's current member name. When a member name change occurs between this WRITEPDS and the last WRITEPDS, a new output member is started.
To rename or build your own output member name, move the new value into MEMNAME of the ddname- in source. This move must be done after each read of the input file because its MEMNAME will reset automatically to its true name (see sample below).
When a file's record is unavailable (such as at EOF, deleted via the DELETE verb, or not present via the SYNC verb), the WRITE command is designed to recognize this condition and skip the request.
"tag" a name up to 8 characters for GOTO branching.
"ddname-out" is the output file to be written
"ddname-in" is the input file to use as a source.
" . " Periods are COBOL like delimiters that end the IF command's conditional requests.
SAMPLE: col 1 .......up to col 71
**********************************************
* write all "PAC" members but rename PAC900 *
* to be PAC901 *
**********************************************
start READPDS procin FOR PAC***** *read pac
IF MEMNAME OF procin = 'pac900 ' *if PAC900
MOVE 'PAC901' TO MEMNAME OF procin * -rename it
WRITEPDS procout FROM procin. * write rec
GOTO start. *loop
PURPOSE: To cross reference source code lines by data name within a PDS library.
DESCRIPTION:
(tag) XREF ddname-in (EXPAND) (.)
SPECIAL NOTES:
The XREF command initiates a report to cross reference source statements. With the combination of READPDS and XREF verbs an entire application can be cross referenced by data name. Useful for analysis questions and for debugging systems. A data name is defined as any name with at least one dash (-) or underscore (_).
The EXPAND keyword allows Assembler programs to be cross referenced by removing the restriction of the underscore/dash.
"tag" a name up to 8 characters for GOTO branching.
"ddname" is the input file name of the record to scan.
"field" is either a label reference to a DEFINES statement, a data value constant, or the explicit
usage of file, length, and position info (see DEFINES).
" . " will delimit an IF statement set.
SAMPLE: col 1 .......up to col 71
*************************************
* cross reference PAC system *
*************************************
start READPDS libin FOR PAC***** *read all pgms
XREF libin. *release record
GOTO start. *loop until done
PURPOSE: To cross reference Dataset names in JCL.
DESCRIPTION:
(tag) XREFDSN ddname-in (.)
SPECIAL NOTES:
The XREFDSN command initiates a report to cross reference JCL dataset names. With the combination of READPDS and XREFDSN verbs entire libraries can be cross referenced by data set name. A data set name is recognized by the DSN= keyword.
"tag" a name up to 8 characters for GOTO branching.
"ddname" is the input file name of the record to scan.
"field" is either a label reference to a DEFINES statement, a data value constant, or the explicit
usage of file, length, and position info (see DEFINES).
" . " will delimit an IF statement set.
SAMPLE: col 1 .......up to col 71
*************************************
* cross reference PAC system *
*************************************
start READPDS proc FOR PAC***** *read all pgms
XREFDSN proc. *release record
GOTO start. *loop until done