The BS2000 procedure to be executed is started in an ENTER-JOB with the CALL-PROCEDURE command. bs2do waits synchronously for the ENTER-JOB to terminate.
Syntax
bs2do[ -DV][ -o outfile] procedure [[(]parameter[)]] |
Debug mode - temporary files are not deleted and remain available for diagnosis.
Verbose - single steps are logged to stdout.
the BS2000 system file SYSOUT opened when the ENTER-JOB is started is copied to the POSIX file outfile.
name of the POSIX file into which the BS2000 system file SYSOUT is copied when the ENTER-JOB is started. outfile can be any POSIX path name.
name of the file containing the BS2000 procedure to be executed. procedure can be any POSIX path name or a string bs2:BS2Name, where BS2Name is a
parameters of the BS2000 procedure to be executed. Entries are made according to the SDF syntax of the PROCEDURE-PARAMETERS operand of the BS2000 /CALL-PROC command, the enclosing parentheses being optional. The following applies to procedure and parameter: special characters (e.g. (, ), $) are to be masked for the shell. bs2do does not interpret the operands, e.g. among other things keywords in keyword parameters are not converted to uppercase. |
File
Input files:
Output files:
|
Variable
BS2DOOPT POSIX path name of an options file. If the environment variable BS2DOOPT is not defined, the implicitly installed options file optionfile is used. |
Hint
Extended description bs2do sets up the batch job #T.pid.ENTER in BS2000, where pid is the POSIX process number of the process executing bs2do. The batch job is initiated with
If the procedure procedure is located in the POSIX file system, it is copied to the BS2000 file T.pid.PRO. The batch job is then started as follows:
The operands PROCESSING-ADMISSION, HOST, JOB-CLASS and JOB-PRIORITY can be set via the options file optionfile. In the batch job, the system file SYSOUT is assigned to the file #T.pid.OUT, the job variable #BS2DOJV is set up and then the procedure is called, the name of the #BS2DOJV job variable can be set via the options file optionfile:
The LOGGING operand can be set via the options file optionfile. The FROM-FILE operand is only specified if procedure is in the POSIX file system. Otherwise, the string procedure is adopted unchanged. Special characters (e.g. (,),$) are to be masked for the shell. After the procedure procedure terminates, the system file SYSOUT is closed and the POSIX shell is started.
The SHELL operand can be set via the options file optionfile. If no error display was set in procedure (/EXIT-PROCEDURE ERROR=NO), the signal SIGUSR1 is sent to the parent process of the batch job as a terminating message. If the error display was set in the procedure procedure (/EXIT-PROCEDURE ERROR=YES), the value of the job variable #BS2DOJV and the signal SIGUSR2 are sent to the parent process of the batch job as a terminating message. In both cases, if the -o outfile option is specified, the file #T.pid.OUT is first copied to the POSIX file outfile. When the shell terminates, all T.pid files are deleted and the batch job is terminated. All temporary #T.pid files are also deleted. In debug mode (-D option), no temporary files are created, but only T.pid files that are not deleted when the batch job terminates. |
The options file
The structure of the options file is as follows:
Lines that do not begin with a valid keyword are ignored. Continuation lines are exceptions to this rule. value can be extended beyond the end of a line with the - character. List of supported keywords and corresponding values: BS2DOJV Job variable name (optional). If job variables are not offered by the product, no value may be specified for this keyword SHELL Operand of START-PROG for loading the POSIX shell PROCESSING-ADMISSION Correspond to the operand of ENTER-JOB with the same name LOGGING Corresponds to the operand of CALL-PROC with the same name The standard options file /opt/BS2DO/options/bs2doopt.std: # # bs2do controlling job variable # (temporary JV in order to allow parallel calls within one userid) # BS2DOJV = #BS2DOJV # # BS2000 enter-job operands # PROCESSING-ADMISSION = SAME HOST = *STD JOB-CLASS = *STD JOB-PRIORITY = *STD # # BS2000 call-proc operands # LOGGING = NO # # optional shell configuration # #SHELL = *M($TSOS.SINLIB.POSIX-BC.vvv.SHELL,SH,RUN-MODE=ADVANCED,PROG-MODE=ANY) # |
Restrictions
Since bs2do cannot bypass the BS2000 security mechanisms, restrictions must be observed if PROCESSING-ADMISSION <> SAME is set in the options file:
|
Example
In the following examples, a prefixed DO: represents the shell prompt which is followed by entries to the shell. Lines between the shell prompts are the outputs from the commands concerned. The procedure proc is included as an example: /BEGIN-PROCEDURE PAR=YES(PROC-PAR=(&CMD='STA',&CMDPAR='L')) / / WRITE-TEXT T='-----> ''&CMD &CMDPAR''' / &CMD &CMDPAR / SKIP-COMMAND TO-LABEL=OK / / SET-JOB-STEP / MOD-JV JV-CONTENTS=#BS2DOJV,- / SET-VALUE=C'Command ''&CMD &CMDPAR'' failed' / SKIP-COMMAND TO-LABEL=ERR / /.ERR REMARK / WRITE-TEXT T='-----> DOING EXIT-PROCEDURE ERROR=YES' / EXIT-PROCEDURE ERROR=YES / /.OK REMARK / WRITE-TEXT T='-----> DOING EXIT-PROCEDURE ERROR=NO' / EXIT-PROCEDURE ERROR=NO / END-PROCEDURE Example 1 Procedure proc in POSIX, simple evaluation of the termination status DO: bs2do proc % JMS0066 JOB ODO492CACCEPTED ON 04-04-23 AT 11:28, TSN=57EE DO: echo $? 0 Example 2Procedure proc in BS2000 file, SYSOUT is output in POSIX DO: bs2do -o example2.out bs2:proc % JMS0066 JOB ODO494CACCEPTED ON 04-04-23 AT 11:29, TSN=57EG DO: cat example2.out /CREATE-JV JV=#BS2DOJV /SET-JOB-STEP /MODIFY-JV JV=#BS2DOJV,SET-VALUE=C' ' /SET-JOB-STEP /CALL-PROC FROM-FILE=proc,LOGGING=NO -----> 'STA L' NAME TSN TYPE PRI CPU-USED CPU-MAX ACCOUNT# DO494 57EG 2 BATCH 9 220 0.6044 32000 1 RLOGIN 57C7 2 DIALOG 0 210 14.3916 9999 1 % SPS0171 NO LOCAL SPOOLOUT JOB PRESENT % SPS0420 RSO WARNING : SOME RSO PRINT-JOBS CANNOT BE DISPLAYED % SCP1095 DPRINTSV WARNING : SOME DPRINT PRINT-JOBS CANNOT BE .. -----> DOING EXIT-PROCEDURE ERROR=NO /SKIP-COMMANDS TO-LABEL=NOERR /.NOERR REMARK /SYSFILE SYSOUT=*DUMMY Example 3Procedure proc in BS2000 PLAM library, erroneous procedure parameter DO: bs2cp proc 'bs2:BS2LIB(PROC,J)' # copy proc in PLAM library DO: bs2do -o example3.out bs2:\(BS2LIB,PROC\) "CMDPAR='x x'" % JMS0066 JOB 'DO501' ACCEPTED ON 04-04-23 AT 12:51, TSN = 57EN BS2DOJV: Command 'STA x x' failed DO:echo $? 1 DO: cat example3.out /CREATE-JV JV=#BS2DOJV /SET-JOB-STEP /MODIFY-JV JV=#BS2DOJV,SET-VALUE=C' ' /SET-JOB-STEP /CALL-PROC FROM-FILE=(BS2LIB,PROC),PROC-PAR=(CMDPAR='x x'),LOGGING= .. -----> 'STA x x' % EXC0898 INVALID OPERAND IN COMMAND. COMMAND REJECTED % CMD0205 ERROR IN PRECEDING COMMAND OR PROGRAM AND PROCEDURE .. -----> DOING EXIT-PROCEDURE ERROR=YES % CMD0205 ERROR IN PRECEDING COMMAND OR PROGRAM AND PROCEDURE .. /SET-JOB-STEP /SKIP-COMMANDS TO-LABEL=ERROR /.ERROR REMARK /SYSFILE SYSOUT=*DUMMY Example 4Procedure proc in POSIX, erroneous procedure parameter, redirection of stderr DO: bs2do proc "CMD='STA P',CMDPAR=',TYPE=x " 2>example4.err DO: echo $? 1 DO: cat example4.err % JMS0066 JOB 'DO620' ACCEPTED ON 04-04-23 AT 15:43, TSN = 57H1 BS2DOJV: Command 'STA P ,TYPE=x' failed |