This code on this page is a modification of the Parsing - Early Techniques. The amendments were conducted in April 2002 on an OS/390 V2.R9 system. The original specification of the program, to extract DSN and PGM from Job Control procedures, is unchanged. The principal change to the code is the replacement of some TRT instructions, with the SRST instruction.
The Translation Table in the Data Constants portion of the program, has been retained because there are times when TRT might be a better instruction to use than SRST.
|
TRTTAB |
  |
DC |
  |
256X'0' |
DEFINES THE TRANSLATION TABLE. |
|
  |
  |
ORG |
  |
TRTTAB+C' ' |
|
|
BLANK |
  |
DC |
  |
CL1' ' |
A BLANK |
|
  |
  |
ORG |
  |
TRTTAB+C',' |
|
|
COMMA |
  |
DC |
  |
CL1',' |
A COMMA |
|
  |
  |
ORG |
  |
TRTTAB+C'=' |
|
|
EQUALS |
  |
DC |
  |
CL1'=' |
AN EQUALS SIGN |
|
  |
  |
ORG |
  |
, |
LOGICAL END OF TABLE |
|   | |||||
|
In respect of finding the program name, the first requirement is to establish whether the statement is an EXEC statement or note. Fortunately the word EXEC should be surrounded by blanks so blank separation can be the Parsing argument. Other truths are that the program name should be preceded by an equals sign, and ended by either a blank or a comma. | |||||
|   | |||||
|
EXECRTN |
  |
LA |
  |
R3,8(0,0) |
MAXIMIMUM LENGTH OF PGM NAME |
|
  |
  |
SR |
  |
R0,R0 |
SET |
|
  |
  |
ICM |
  |
R0,1,BLANK |
- - ->UP |
|
  |
  |
LA |
  |
R4,MEMBER |
- - - - - ->FOR |
|
  |
  |
LA |
  |
R6,CARDCONT |
- - - - - - - - ->WIDE SCAN |
|
  |
  |
SRST |
  |
R6,R4 |
FIND THE FIRST BLANK. |
|
  |
  |
BC |
  |
2,READPROC |
NOT FOUND - NEXT RECORD |
|
NEXTBLNK |
  |
CLI |
  |
0(R1),C' ' |
LOOP |
|
  |
  |
BNE |
  |
NONBLANK |
- - - ->TILL |
|
  |
  |
LA |
  |
R1,1(,R1) |
- - - - - - ->BLANKS |
|
  |
  |
B |
  |
NEXTBLNK |
- - - - - - - - - - ->EXHAUSTED |
|
NONBLANK |
  |
CLC |
  |
=CL5'EXEC ',0(R1) |
IS IT AN EXEC STATEMENT? |
|
  |
  |
BNER |
  |
R11 |
NO - RETURN FOR DSN CHECK. |
|
  |
  |
LR |
  |
R4,R1 |
YEP - ASSIGN NEW SCAN START ADDR |
|
FINDPGM |
  |
ICM |
  |
R0,1,EQUALS |
LOOK |
  |
  |
LA |
  |
R6,CARDCONT |
- - - - ->FOR |
|
  |
  |
SRST |
  |
R6,R4 |
- - - - - - - ->AN EQUALS SIGN. |
|
  |
  |
BC |
  |
1,GOTEQUAL |
GOT ONE, HANDLE IT, ELSE |
|
  |
  |
B |
  |
READPROC |
- - - - -> GET NEXT RECORD. |
|
GOTEQUAL |
  |
LA |
  |
R4,1(,R1) |
R4 = START OF PGM NAME! |
|
  |
  |
LR |
  |
R15,R4 |
- - - ->SAVE THIS LOCATION. |
|
  |
  |
EX |
  |
R3,TRTI |
FIND END OF PGM NAME. |
|
  |
  |
SR |
  |
R1,R15 |
CALCULATE LENGTH |
|
  |
  |
BCTR |
  |
R1,0 |
- - - - - - - - - - - - - ->OF PGM NAME. |
|
  |
  |
MVC |
  |
XREFPGM,=CL8' ' |
SAVE |
|
  |
  |
EX |
  |
R1,MOVEPGM |
- - - ->PROGRAM NAME. |
|
  |
  |
B |
  |
READPROC |
GO GET NEXT RECORD. |
|   | |||||
The following instruction are necessary, outside the loop, to allow successful execution of the EX instructions, | |||||
|   | |||||
|
MOVEPGM |
  |
MVC |
  |
XREFPGM(0),0(R15) |
MOVE PROGRAM NAME. |
Copyright © KMS-IT Limited 2002