HP 3000 Manuals

Examples [ RJE User/Programmer Reference Manual ] MPE/iX 5.0 Documentation


RJE User/Programmer Reference Manual

Examples 

This section includes two stream file examples, an interactive example,
and a user-written program example.

Stream File Example 1 

The following example shows RJE being invoked as a job so that multiple
users can transmit and receive information.

   1.  The user and account must have the required capabilities to run
       this subsystem.

            !JOB OPERATOR.SYS

   2.  These formal designators are for the device classes indicated to
       provide access to peripheral devices.

            !FILE LP;DEV=PRINTER
            !FILE TP;DEV=TAPE
            !FILE CP;DEV=PUNCH

   3.  The RJE subsystem is entered with default files implied; $STDINX
       is the default input (command) file.  Since this is a job, the
       commands follow next.

            !RJE

   4.  The subsystem command opens the line with RJE emulating an IBM
       2780.  This host session of RJE is linked to the message file
       MSG70, a permanent file in MSG.RJE.

            #RJLINE 2780;MSGFILE=MSG70;DEV=RJLINE

   5.  The input file referenced, SIGNON70, is a disk file containing a
       SIGNON card image appropriate to the host system.

            #RJIN SIGNON70

   6.  The transmission of the preceding command is completed and an EOT
       character is transmitted.  If DIAL is the default connect state
       and there is a telephone number configured, then a dial message is
       issued at this time.

            #RJEOD

   7.  This command sets the conditions for multiple users to access the
       communications line.  Although this is not a requirement, the wait
       timer is disabled.

            #RJOUT *LP;WAIT=0;INTERRUPT=YES

       _________________________________________________________________ 

       NOTE  The #RJOUT command is the last subsystem command within the
             command file.  This ensures that all commands within the
             file will be read and processed before RJE may interrupt
             this command to read another command file (one pointed to by
             the message file MSG70).

       _________________________________________________________________ 

   8.  This command is executed after the RJE subsystem terminated.
       Interrupt mode was terminated after a command file executed #RJOUT
       with INTERRUPT=NO. The RJE subsystem is then terminated with an
       #RJEND in that command file.

            !EOJ

Stream File Example 2 

The following stream file illustrates various features of programmatic
control mode operations:

   1.  Log onto the system to create a message file.  Note that this must
       be in group and account MSG.RJE.

            !JOB RJEJOB,USER.RJE,MSG

       Verify that USER has OP capability.

       for RJE/V: 

            !RUN LISTDIR5.PUB.SYS
            LISTUSER USER
            EXIT

       for RJE/XL: 

            !LISTUSER USER

   2.  Remove any existing file named MESSAGE.

            !PURGE MESSAGE

   3.  Create a MSG file named message of sufficient size and record
       length to accommodate system activity and fully qualified command
       file names.

            !BUILD MESSAGE;REC=-80,1,V,ASCII;MSG;DISC=500

   4.  Using the FCOPY utility post two command file names, RJCMDF2 and
       RJCMDF3, from group and account MSG.RJE to what will be a message
       file, MESSAGE.MSG.RJE.

            !FCOPY FROM=;TO=MESSAGE.MSG.RJE
            RJCMDF2.MSG.RJE
            RJCMDF3.MSG.RJE
            !EOD

   5.  Run a user developed routine CMDSBMT similar to that found in the
       last example in this section to post two command file names,
       RJCMDF4 and RJCMDF5, from group and account MSG.RJE to what will
       be a message file, MESSAGE.MSG.RJE.

            !RUN CMDSBMT.MSG.RJE
            MESSAGE.MSG.RJE
            RJCMDF4.MSG.RJE
            RJCMDF5.MSG.RJE

       The last line should be a blank line acting as an end sentinel.

   6.  Enter RJE using default command, input, list, and punch files.

            !RJE

   7.  Identify the communications line.  Notice that the message file is
       identified.

            #RJLINE 3780;LINECODE=EBCDIC;DEV=RJE80;&
            #CONNECT=DIAL,732-0495; MSGFILE=MESSAGE.MSG.RJE

   8.  Transmit a SIGNON card image to the system.

            #RJIN SIGNON

   9.  #RJEOD

  10.  Post an interruptible #RJOUT subsystem command.  This will be
       immediately interrupted because there have been four command files
       already identified to the message file in preceding steps.

            #RJOUT ;INTERRUPT=YES

       Programmatic control mode takes effect at this point.

  11.  This message appears on $STDLIST. The new command file was
       identified to the message file at step 4.

            **RJOUT INTERRUPTED: MSG. FILE
            **New Command File: RJCMDF2.MSG.RJE

  12.  Two files, RJJOB1 and RJJOB2 will be transmitted to the host
       system from the logon account.  Once the line is turned around by
       the #RJOUT command, four data sets are expected.

       These are to be printed at $STDLIST. In the stable host situation
       used to prepare this example these were the exact number of data
       sets expected because of the input.

            #RJIN RJJOB1
            #RJIN RJJOB2
            #RJOUT ,4

  13.  Because the end of file RJCMDF2.MSG.RJE has been reached, end
       command file action will occur.  An end of file message is
       printed.  Since a saved #RJOUT is available, it is in effect from
       step 10.  As in step 11, that command is interrupted and control
       is passed to a new command file, RJCMDF3.MSG.RJE.

            *COMMAND FILE END OF FILE*

            *** SAVED RJOUT IS NEXT **
            RJOUT ;INTERRUPT=YES
            RJOUT INTERRUPTED; MSG. FILE
            *** New Command File: RJCMDF3.MSG.RJE

  14.  One job is transmitted.  The line is turned around at once to
       receive one data set.  In this instance a host system message was
       received that indicated the job had been received.

            #RJIN RJJOB1
            #RJOUT

  15.  This subsystem command is described in Chapter 3, "RJE User
       Commands." In effect it is an #RJIN of the information on the
       command line, followed immediately by an #RJOUT. Here the host
       system command /*$DN is transmitted.  Because there was no other
       data set ready except the output for this command, the information
       in response to the /*$DN command was received.  If another data
       set had been ready, it would have been received at $STDLIST.

            #RJIO /*$DN

  16.  Output created by the job submitted in step 14 is anticipated and
       expected.  This is to be retained in file RJOUT1 of the logon
       group and account.

            #RJOUT RJOUT1

  17.  Because the end of file RJCMDF3.MSG.RJE has been reached, end
       command file action will occur.  An end of file message is
       printed.  Since a saved #RJOUT is available, from step 13, it is
       in effect.  As in step 13, that command is interrupted and control
       is passed to a new command file, RJCMDF4.MSG.RJE.

            *COMMAND FILE END OF FILE*

            *** SAVED RJOUT IS NEXT **
            RJOUT ;INTERRUPT=YES
            RJOUT INTERRUPTED: MSG. FILE
            *** New Command File: RJCMDF4.MSG.RJE

       This command file was written to the message file with the
       user-supplied routine identified in step 6.

  18.  One job is transmitted.  The line is turned around at once to
       receive one data set.  In this instance a host system message was
       received that indicated the job had been received.

            #RJIN RJJOB2
            #RJOUT

  19.  Because the end of file RJCMDF4.MSG.RJE has been reached, end
       command file action will occur.  An end of file message is
       printed.  Since a saved #RJOUT is available, it is in effect from
       step 10.  As in step 11, that command is interrupted and control
       is passed to a new command file, RJCMDF5.MSG.RJE.

            *COMMAND FILE END OF FILE*

            *** SAVED RJOUT IS NEXT **
            RJOUT ;INTERRUPT=YES
            RJOUT INTERRUPTED: MSG. FILE
            *** New Command File: RJCMDF5.MSG.RJE

  20.  Another request is posted to receive a data set from the host
       system.  Note that in this command INTERRUPT=NO. As a result,
       programmatic control mode is concluded.

            #RJOUT ;INTERRUPT=NO

  21.  When RJE is executing in batch mode and programmatic control in
       interrupt mode is terminated, subsystem operation will end.  The
       end of the stream file has been encountered.  Control is returned
       from this job to the operating system.

            !EOJ

Interactive Example 

The following example shows RJE being invoked in an interactive session
so that multiple users can submit and receive information.

   1.  These file statements, with formal file designators, identify the
       device classes for peripherals.

            :FILE LP;DEV=PRINTER
            :FILE TP;DEV=TAPE
            :FILE CP;DEV=PUNCH

   2.  This MPE command identifies a file on disk that contains three
       subsystem commands.

            :RJE CMDSET

   3.  This RJE subsystem command causes RJE to emulate an IBM 3780.  The
       line transmission code will be EBCDIC. The message file for this
       host session is MSG70.MSG.RJE.

            #RJLINE 3780;LINECODE=EBCDIC;DEV=21;MSGFILE=MSG70

   4.  The disk file identified in this subsystem command contains an
       appropriate signon card image.  Once it has been transmitted the
       subsequent #RJEOD command causes an EOT to be sent.

            #RJIN SIGNON70
            #RJEOD

   5.  This command sets up the conditions enabling multiple users to
       send and receive data with RJE.

            #RJOUT *LP;INTERRUPT=YES

RJE will begin to process the records in file MSG70, which was indicated
by the parameter MSGFILE. These records contain file names as follows:

     MONDAY.DATA.ACCTING
     DAILY.DATA.SHIPPING
     WKLY.DATA.MKTING
     SPECIAL.DATA.MKTING

File MONDAY.DATA.ACCTING contains these subsystem command records:

     #RJIN *TP
     #RJEOD
     #RJOUT MONDAY.SUMMARY.ACCTING

A file will be transmitted from formal designator 'TP' in device class
'TAPE'. Upon completion of transmission, a request is made to transmit a
data set to file MONDAY.SUMMARY.ACCTING. Control is then returned to the
repeating #RJOUT command.  After it begins execution again, it is
interrupted by the next record in file MSG70.

File DAILY.DATA.SHIPPING contains these subsystem command records:

     #RJIN DAILY.INFO.SHIPPING
     #RJOUT *LP

A file of information is transmitted from DAILY.INFO.SHIPPING. On
completion, the line is turned around and a request is made to transmit a
data set to formal file designator LP, a device in class 'PRINTER'. The
repeated #RJOUT is not destroyed.  On completion of output transmission
from the host system control is returned to file MSG70.

File WKLY.DATA.MKTING contains these subsystem command records:

     #RJIN *TP
     #RJPUNCH *CP

A request is made for transmittal of a file of information from a device
in class 'TAPE'. On completion of transmission, the line is turned around
and an EOT is sent to the host system.  A request is made to transmit a
data set to a device identified by the designator CP in device class
'PUNCH'. On completion, control is returned to file MSG70.

File SPECIAL.DATA.MKTING contains these subsystem command records:

     #RJIO /*$DA

Output from the #RJIO command will appear on the terminal at this point.

     #RJIN HOTJOB
     #RJOUT HOTJOBOP

This file contains two output commands.  First, a host terminal command,
/*$DA, is transmitted as a one-record file.  Because an #RJIO command is
used, the line is turned around and output is requested for a single data
set with an implicit #RJOUT subsystem command.  Output is directed to
$STDLIST.


NOTE If another output data set is ready at the time the line is turned around, then it may be transmitted before the one expected by the #RJIO command.
Once one data set has been received in response to the #RJIO subsystem command the line is turned around and the file HOTJOB is transmitted to the remote host system. At completion of transmission an EOT is sent to the host system and the line is turned around. A request is made to send the next ready output data set to file HOTJOBOP in the logon group and account.
NOTE If another output data set is ready at the time the line is turned around, then it may be transmitted before the one expected when #RJOUT HOTJOBOP was issued.
On completion of the second #RJOUT subsystem command, control is returned to file MSG70. Since there are no other records to be read from the message file, control is returned to the repeating #RJOUT command: :RJOUT *LP;REPEAT=YES;INTERRUPT=YES. This command was entered in step (7), above. It can be cancelled with a [CTRL]-Y. User-Written Program Example The message file identified in the #RJLINE subsystem command is where RJE will find references to the command files submitted by users for processing. Users of RJE may write routines like the following to write command file names to a message file. Access to subordinate command files occurs when INTERRUPT=YES is set in an operating #RJOUT command and a legitimate command file reference is present in a message file. Overview CMDSUBMT writes the name of an RJE command file to an RJE message file. You are prompted for the message file name. The name is then verified as being that of a valid message file. If the name is not that of a valid message file then an error message is printed and you are again prompted for the message file name.
NOTE Only the file name need be supplied since the message file must reside in the MSG.RJE group and account. CMDSUBMT only reads the first eight characters entered by the user.

NOTE To exit from CMDSUBMT, press [ENTER].
Once the message file is opened and determined to be valid, you are prompted to supply the fully qualified command file name. It is ascertained that the file exists before the name is written to the message file. You will continue to be prompted for command file names until an [ENTER] is encountered. Declarations. INTEGER fopt := %2054, <<FOPTIONS for users terminal >> aopt := 0, <<AOPTIONS for users terminal >> r'lngth, <<actual length of read from terminal >> r'len, <<max length of read from terminal >> fs'errcode, <<error # returned from FCHECK >> msg'fnum, <<file # of the message file >> cmd'fnum, <<file # of the command file >> infile'num; <<file # of users terminal >> INTEGER set'timeout := 4; <<fcontrol parameter for setting write timeouts >> INTEGER five'seconds := 5; <<length of write timeout set by fcontrol >> LOGICAL valid'msgfile := FALSE, <<set TRUE if message file valid>> exit := FALSE, <<set TRUE when only CR returned >> msgfopt; <<determine if valid msgfile >> LOGICAL ARRAY prompt1 (0:12) := "ENTER NAME OF MSGFILE :"; LOGICAL ARRAY prompt2 (0:15) := "ENTER NAME OF COMMAND FILE:"; LOGICAL ARRAY emsg1(0:16) := "** FILE IS NOT A MSGFILE**"; LOGICAL ARRAY emsg2(0:17) := "** UNABLE TO OPEN COMMAND FILE**"; LOGICAL ARRAY error'msg (0:5):= "FSERR #"; LOGICAL ARRAY fname (0:24); << Contains ascii characters of either command or message file name--FOPEN parameter. >> BYTE ARRAY err'msg(*)=error'msg; << Contains ascii characters of file system error message.>> BYTE ARRAY cmd'fname(*)=fname; << Contains ascii characters representing command file name.>> BYTE ARRAY msg'fname(*)=fname; << Contains ascii characters representing message file name.>> INTRINSIC FOPEN, FCLOSE, FREAD, FWRITE, FCHECK, FGETINFO, FCONTROL, PRINT, ASCII, DEBUG; Main. << Open $STDIN (user terminal) and initialize number of input characters to read.>> infile'num := FOPEN (, %244); r'len := -8; << Repeat message file prompt until valid message file obtained or the user exists from the program.>> DO BEGIN << Obtain a message file name from the user. >> msg'fname := " "; MOVE msg'fname(1) := msg'fname,(48); PRINT (prompt1, -23, %320); r'lngth := FREAD (infile'num, fname, r'len); WHILE msg'fname (r'lngth) = " " DO r'lngth := r'lngth -1; << If the input characters were not all blanks, then do the following: 1. Force message file to be in group.account MSG.RJE. 2. Open message file with message file, variable length record, ascii, old permanent file foptions and append, one reader/multiple writers, and inter-job multi-access aoptions set. 3. If file cannot be opened or file is not a valid message file, print error message and reprompt.>> IF r'lngth > 0 THEN BEGIN << 1. >> MOVE msg'fname (r'lngth+1) := ".MSG.RJE"; << 2. >> msg'fnum := FOPEN (msg'fname, %32105, %2203); << 3. >> IF <> THEN BEGIN FCHECK (msg'fnum, fs'errcode); ASCII (fs'errcode, 10, err'msg(9)); PRINT (error'msg, -11, %40); END ELSE BEGIN FGETINFO (msg'fnum,,msgfopt); IF msgfopt.(2:3) = %6 THEN valid'msgfile := TRUE ELSE BEGIN FCLOSE (msg'fnum, 1, 0); PRINT (emsg1, -30, %40); END; END; END ELSE exit := TRUE; END UNTIL (valid'msgfile = TRUE or exit = TRUE); <<Step 2>> << Initialize the number of input characters to be read.>> r'len := -35; << Repeat command file prompting until user exits from program.>> WHILE (exit = FALSE) DO BEGIN << Obtain command file name from user.>> PRINT (prompt2, -29, %320); cmd'fname := " "; MOVE cmd'fname(1) := cmd'fname,(34); r'lngth := FREAD (infile'num, fname, r'len); WHILE cmd'fname(r'lngth-1) = " " DO r'lngth := r'lngth -1; << If input characters are not all blanks then do the following: 1. Open the command file with ascii, old file f options. 2. If command file open fails, print error message 3. If command file open succeeds, write command file name into the message file after setting a write timeout to guard against process hang if message file is full.>> IF r'lngth > 0 THEN BEGIN << 1. >> cmd'fnum := FOPEN (cmd'fname, %7); << 2. >> IF <> THEN BEGIN FCHECK (cmd'fnum, fs'errcode); ASCII (fs'errcode, 10, err'msg(9)); PRINT (emsg2, -33, %40); PRINT (error'msg, -11, %40); END << 3. >> ELSE BEGIN FCLOSE (cmd'fnum, 1, 0); FCONTROL (msg'fnum, set'timeout, five'seconds); FWRITE (msg'fnum, fname, -35, 0); END; END ELSE exit := TRUE; END; << Close the message file.>> FCLOSE (msg'fnum, 1, 0); END. The following is an example of the way in which a program like the one in this section could be used after it has been compiled and prepared: :FILE LP;DEV=LP <<File equation for listing>> :SPL CMDSUBS,CMDSUBU,*LP <<Compile source.>> :PREP CMDSUBU,CMDSUBMT <<Prepare program file.>> :RUN CMDSUBMT <<Execute program file.>> ENTER NAME OF MSGFILE: MSGFILE <<Destination of file names.>> ENTER NAME OF COMMAND FILE: MONDAY.DATA.ACCTING ENTER NAME OF COMMAND FILE: DAILY.DATA.SHIPPING ENTER NAME OF COMMAND FILE: SPECIAL.DATA.MKTING <<Command file names to be written to the message file.>> ENTER NAME OF COMMAND FILE: [ENTER] <<Exit from program.>> END OF PROGRAM


MPE/iX 5.0 Documentation