Your Browser is not longer supported
Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...
{{viewport.spaceProperty.prod}}
&pagelevel(4)&pagelevel
1. Substituting job variables in dialog mode:
/cre-jv jv=egon ———————————————————————————————————————————————————— (1)
/mod-jv jv=egon,set-value='SHOW-FILE-ATTR' ———————————————————————————— (2)
/&(cmd) ——————————————————————————————————————————————— (3)
% 3 :2OSG:$USER1.ALT.SYS.LOGON.USERPROC.X1
% 51 :2OSG:$USER1.ALT.SYSSDF.USER.EXAMPLE.1
% 21 :2OSG:$USER1.DATEI.1
% 48 :2OSG:$USER1.DATEI.2
% 84 :2OSG:$USER1.DATEI.3
% 66 :2OSG:$USER1.OUT.SORT1-2
% 3 :2OSG:$USER1.PROC.JV
%:2OSG: PUBLIC: 7 FILES RES= 276 FRE= 39 REL= 21 PAGES
/mod-jv jv-=egon,set-value='-FILE-ATTR F-NAME=PROC.' ————————————————— (4)
/set-jv-link link-name=walter,jv-name=egon ——————————————————————————— (5)
/sh&(*walter)
% 3 :2OSG:$USER1.PROC.JV ———————————————————————————————————— (6)
%:2OSG: PUBLIC: 1 FILE RES= 3 FRE= 2 REL= 0 PAGES
|
(1) | The job variable name ‘EGON’ is declared. |
(2) | The job variable EGON is assigned the value ‘SHOW-FILE-ATTR’ (short for the name of the command SHOW-FILE-ATTRIBUTES). |
(3) | After the command has been sent off, the variable string is replaced with the command defined in the job variable, and the command is executed. |
(4) | The value of job variable EGON is changed. It now contains only part of the command name (‘-FILE-ATTRIBUTES’) and the partially qualified file name ‘PROC.’. |
(5) | Job variable EGON is assigned the link name ‘WALTER’. |
(6) | After the command has been sent off, the variable string is replaced with the command portion assigned to the job variable, and the command is executed. The reference to the job variable is established via the link name. |
2. Substituting job variables and S variables in dialog mode
/sh-jv cmd ----------------------------------------------------------------- (1) %SHOW-FILE-ATTR /&(cmd) proc.jv ------------------------------------------------------------ (2) % 3 :2OSG:$USER1.PROC.JV %:2OSG: PUBLIC: 1 FILE RES= 3 FRE= 2 REL= 0 PAGES /cmd='PRINT-DOCUMENT' ---------------------------------------------------- (3) /sh-var cmd CMD = PRINT-DOCUMENT /&(cmd) proc.jv --------------------------------------------------------- (4) % SCP0810 SPOOLOUT FOR FILE ':2OSG:$USER1.PROC.JV' ACCEPTED. TSN: '1FAL', SPOOL OUT-NAME: 'SDFTEST', MONJV: '*NONE' % SCP1025 PRINT JOB ACCEPTED BY SERVER 'GH5090Y0' WITH TSN '5BXC' /&(:2osg:cmd) proc.jv ---------------------------------------------------- (5) % 3 :2OSG:$USER1.PROC.JV %:2OSG: PUBLIC: 1 FILE RES= 3 FRE= 2 REL= 0 PAGES /&(jv(jv-name='CMD')) proc.jv -------------------------------------------- (6) % 3 :2OSG:$USER1.PROC.JV %:2OSG: PUBLIC: 1 FILE RES= 3 FRE= 2 REL= 0 PAGES / |
(1) | The job variable CMD has the value SHOW-FILE-ATTR . |
(2) | The command name from the job variable CMD is substituted i.e. SHOW-FILE-ATTRIBUTES is executed for the file PROC.JV . |
(3) | The S variable CMD is created implicitly by being assigned the value PRINT-DOCUMENT. |
(4) | The expression &(CMD) in the input is now replaced by the contents of the S variable CMD , i.e. the command PRINT-DOCUMENT is executed for the file PROC.JV. |
(5) | The name of the job variable CMD is prefixed by the catalog ID in order to retain its contents during substitution. |
(6) | Job variable substitution can alternatively be achieved using the builtin function JV( ). |
3. Submitting the name of the job variable to be substituted as procedure parameter of a non-S procedure
/BEGIN-PROC PAR=*YES(PROC-PAR=(&PARAM1)) ———————————————————————————— (1)
.
.
.
/SET-JV-LINK LINK-NAME=PARAM1,JV-NAME=&PARAM1 ————————————————— (2)
/&(*PARAM1) FILE-NAME=LST.JOB ————————————————————————————————— (3)
.
.
.
/END-PROC
(1) | The job variable to be specified via procedure parameter PARAM1 is to contain the current command to be executed. As the entry “&(&PARAM1)” is illegal, a link name will have to be assigned. See Example 4 for the optional use of a nested expression. |
(2) | The current job variable name is inserted for procedure parameter PARAM1 and assigned the link name PARAM1. |
(3) | The contents of the declared job variable are substituted for the link name PARAM1. For instance, if the job variable value is
PRINT-DOCUMENT DOCUMENT-FORMAT=*TEXT(LINE-SPACING= *BY-EBCDIC- CONTROL), LAYOUT-CONTROL=*PAR(ROTATION=90, LEFT-MARGIN=10)
then the file LST.JOB is printed as specified. If the job variable value changes to
SHOW-FILE-ATTRIBUTES INFORMATION=*PAR(HISTORY=*YES, SECURITY=*YES) , the requested file attributes of the file LST.JOB are displayed. |
4. Substituting job variables and S variables in an S procedure, the job variable name being submitted as a procedure parameter
Contents of procedure file DO.JVTEST:
/ SET-PROC-OPT JV-REPLACE=*AFTER-BUILTIN
/ DECL-PAR JV-1(INIT=*PROMPT)
/ &(JV(JV-NAME=JV-1)) FILE-NAME=LST.JOB
/ERR: IF-BLOCK-ERROR
/ WRITE-TEXT C'** Error &MC **'
/ ELSE
/ WRITE-TEXT C'** Command &(&(JV-1)) executed **'
/ END-IF
/END: EXIT-PROC
Procedure execution:
/show-jv jv=cmd ------------------------------------------------------------- (1) %SHOW-FILE-ATTR /call-proc do.jvtest,log=*yes
% 2 1 /DECL-PAR JV-1(INIT=*PROMPT)
%JV-1: cmd ---------------------------------------------------------------- (2)
% 3 1 /SHOW-FILE-ATTR FILE-NAME=LST.JOB ------------------------ (3)
% 3 :N:$USER0001.LST.JOB
%:N: PUBLIC: 1 FILE RES= 3 FREE= 3 REL= 3 PAGES
% 4 1 /FEHL:
% 4 1 / IF-BLOCK-ERROR
% 6 1 /ELSE
% 7 1 /WRITE-TEXT C''** Command SHOW-FILE-ATTR executed **'
'** Command SHOW-FILE-ATTR executed ** ------------------------------------ (4)
% 8 1 /END-IF
% 9 1 /ENDE:
% 9 1 / EXIT-PROC
/
|
(1) | SHOW-FILE-ATTR is displayed as the contents of job variable CMD .
|
(2) | After invoking the procedure DO.JVTEST , the procedure parameter JV-1 is prompted for and assigned the value CMD . The expression is replaced by the job variable value as ascertained by the builtin function JV( ). The desired job variable name is passed to the builtin function via S variable JV-1 . |
(3) | The command SHOW-FILE-ATTRIBUTES is executed. |
(4) | A nested expression is used at this point:A job variable is to be substituted, its name being derived from the expression to be substituted for S variable JV-1 . As a result, the contents of job variable CMD are substituted. This is possible only if there is no S variable or builtin function of the same name and if job variable substitution has been specified explicitly in SET-PROCEDURE-OPTIONS. |