HP 3000 Manuals

About the Job Stream Examples [ HP RPG/XL Utilities-Part 1 XSORT ] MPE/iX 5.0 Documentation


HP RPG/XL Utilities-Part 1 XSORT

About the Job Stream Examples 

The easiest way to prepare job control commands is to enter them in a
disk file using EDIT/3000.  When you want to run a job stored in a disk
file, you can use the MPE :STREAM command.  All of the stream jobs
described in the examples use this method.

When preparing a job to be streamed, you must substitute another
character for the colon normally used with MPE commands.  Any ASCII
character may be used except the letters A through Z or the numbers 0
through 9.  The character most commonly used is the exclamation point.

Although each of the job stream examples has unique characteristics, all
have some in common.  A general discussion of the commands for Example 1
will cover most of the common ground for the various sort configurations
covered here.  Where unique qualities are present, additional
explanations will be appended to the example.

Example 1: 
Job Stream With Specifications Imbedded 

Single input to different output.

    1     !JOB TSTXSRT1,MGR.SUBSYS,XSORT;OUTCLASS=,1

    2     !COMMENT  *************************

          !COMMENT  *************************

          !COMMENT THIS IS AN EXAMPLE OF HOW TO USE "XSORT" WITH

          !COMMENT SINGLE INPUT-TO-DIFFERENT OUTPUT

    3     !FCOPY FROM=TSTIN;TO=

    4     !PURGE TSTOUT

    5     !FILE XSORTIN=TSTIN

    6     !FILE XSORTOUT=TSTOUT

    7     !RUN XSORT.PUB.SYS

    8     0000HSORTR     4A         X 33

          00005I C      33NECX

          00010FNC   6   9

          00020FDC   1  32

          00030FDV         *

    9     !EOD

    10    !SAVE TSTOUT

          !FCOPY FROM=TSTOUT;TO=

    11    !EOJ

   1.  The first command in a job must be the JOB command, followed by
       the user name, account name, and optionally the group name.  In
       production work it is useful to specify a job name before the user
       name to identify the specific job that is being run.  In this
       example, TSTXSRT1 is the job name.

   2.  Comment lines are used to describe the function or nature of the
       job.

   3.  The first program to be run in the job is FCOPY. It is included in
       order to show the contents of the input file prior to sorting.
       FCOPY is instructed to copy from the file TSTIN to the standard
       job/session device, $STDLIST.

   4.  A file named TSTOUT is used for each of the jobs.  It is purged
       initially to make sure that the name does not exist in the group.

   5.  The file referenced as XSORTIN is equated to the actual file named
       TSTIN.

   6.  The file referenced as XSORTOUT is equated to the actual file
       named TSTOUT.

   7.  The program XSORT.PUB.SYS is run.

   8.  These are the specifications for the sort.  Note that they are not
       entered with the exclamation point since they are used as data by
       the XSORT program, instead of being used as MPE commands.

   9.  !EOD, entered with an exclamation point, indicates that you have
       entered all necessary data for the sort.

  10.  The output file TSTOUT is to be saved.

  11.  !EOJ signifies that you have completed the job entries.

The following is a physically condensed copy of the previous example
after it was run.  It includes the output of the sort.

     :JOB TSTXSRT1,MGR.SUBSYS,XSORT
     PRIORITY = DS; INPRI = 8; TIME = UNLIMITED SECONDS
     JOB NUMBER =   #J59
     WED, MAR  11,  1981,   9:44.AM
     HP3000 /  MPE  IV C.00.P8
     D U K E
     COMMENT   *************************
     :COMMENT   *************************
     :COMMENT  THIS IS AN EXAMPLE OF NOW TO USE "XSORT" WITH
     :COMMENT  SINGLE INPUT-TO-DIFFERENT OUTPUT
     :FCOPY FROM=TSTIN;TO=

     HEWLETT-PACKARD 32212A.3.13 FILE COPIER WED, MAR 11, 1981, 9:44 AM
     (C)-HEWLETT-PACKARD CO. 1980

     *200*
     WARNING:  FROMFILE RECSIZE IS 72 BYTES, TOFILE RECSIZE IS 133 BYTES.
                                                                   .
     AB123GSD212345      JONES           X
     AB234CIC012345      ALBERS
     AC102GSD100001      WOODSON
     AC321ABCD10001      FRANKEN
     BB222CIC012345      WOODS
     EOF FOUND IN FROMFILE AFTER RECORD 4
     5 RECORDS PROCESSED *** 0 ERRORS
     ∅
     END OF SUBSYSTEM
     :PURGE TSTOUT
     :FILE XSORTIN=TSTIN
     :FILE XSORTOUT=TSTOUT
     :RUN XSORT.PUB.SYS

     HP32104A.05.00      EXTRA  FUNCTION SORT FOR RPG/3000       (XSORT)
     (C) HEWLETT-PACKARD  CO. 1980     WED, MAR 11, 1981,   9:44 AM

     00000HSORTR    4A           X  33
     00005I C     33NECX
     00010FNC  6   9
     00020FDC  1  32
     00030FDV        *

     RECORDS READ = 5
     RECORDS SELECTED & SORTED = 4
       NUMBER OF COMPARES = 7
       SCRATCHFILE I/O = 2
       CPU SECONDS = .335
       ELAPSED SECONDS = 2.992
     TOTAL CPU SECONDS = 1.006

     END OF PROGRAM
     :SAVE TSTOUT
     :FCOPY FROM=TSTOUT;TO=

     HEWLETT-PACKARD 32212A.3.13 FILE COPIER      WED, MAR 11, 1981,     9:45 AM
     (C) HEWLETT-PACKARD CO. 1980

     *200*
     WARNING:  FROMFILE RECSIZE IS 33 BYTES, TOFILE RECSIZE IS 133 BYTES.

     AC321ABCD10001      FRANKEN     *
     AB234CIC012345      ALBERS      *
     BB222CIC012345      WOODS       *
     AC102GSD100001      WOODSON     *
     EOF FOUND  1N  FROMFILE AFTER  RECORD 3
     4 RECORDS PROCESSED *** 0 ERRORS

     END OF SUBSYSTEM
     :EOJ
     CPU SEC. = 6.  ELAPSED MIN. = 1.  WED, MAR 11, 1981,    9:45 AM

Example 2: 
Job Stream with XSORTEXT. 

Single input to different output.

     !JOB TSTXSRT2,MGR.SUBSYS,XSORT;OUTCLASS=,1
     !COMMENT THIS IS AN EXAMPLE OF A SINGLE INPUT-TO-
     !COMMENT DIFFERENT-OUTPUT SORT.THE JOB IS STREAMED,
     !COMMENT THE SPECIFICATIONS ON XSORTEXT.
     !COMMENT******************************************
     !COMMENT******************************************
     !FCOPY FROM=TSTIN;TO=
     !PURGE TSTOUT
     !FILE XSORTIN=TSTIN
     !FILE XSORTOUT=TSTOUT
     !FILE XSORTEXT=TSTSPEC
     !RUN XSORT.PUB.SYS
     !SAVE TSTOUT
     !FCOPY FROM=TSTOUT;TO=
     !EOJ


NOTE The only difference between Example 1 and Example 2 is the use of TSTSPEC in the equation using XSORTEXT. TSTSPEC is an EDITOR file containing the same XSORT specs as those imbedded in the previous job stream.
Example 3: Session With the Specifications Entered Interactively. Single input to different output. :PURGE TSTOUT :FILE XSORTIN=TSTIN :FILE XSORTOUT=TSTOUT :RUN XSORT.PUB.SYS HP32104A.05.00 EXTRA FUNCTION SORT FOR RPG/3000 (XSORT) (C) HEWLETT-PACKARD CO. 1980 WED, MAR 11, 1981, 9:16 AM 00000HSORTR 4A X 33 00000NSORTR 4A X 33 00005I C 33NECX 00005I C 33NECX 00010FNC 6 9 00010FNC 6 9 00020FDC 1 32 00020FDC 1 32 00030FDV * 00030FDV * : EOD RECORDS READ = 5 RECORDS SELECTED & SORTED = 4 NUMBER OF COMPARES = 7 SCRATCHFILE I/O = 2 CPU SECONDS = .440 ELAPSED SECONDS = 1.884 TOTAL CPU SECONDS = 1.779 END OF PROGRAM :SAVE TSTOUT 1. After the command to run XSORT is given, the program prints an identification banner. When it is completed, the user enters the specifications for the session. 2. The specifications, which the user enters without prompting from XSORT, are echoed back to the terminal. (Note that the echoing can be eliminated by specifying a Print Option of 1, 2, or 3 in Header column 27.) 3. The user must supply the colon before the EOD. Example 4: Using XSORTEXT, Case 1 Single input to different output. Both XSORTIN and XSORTOUT are disk files. :PURGE TSTOUT :FILE XSORTIN=TSTIN :FILE XSORTOUT=TSTOUT :FILE XSORTEXT=TSTSPEC :RUN XSORT.PUB.SYS HP32104A.05.00 EXTRA FUNCTION SORT FOR RPG/3000 (XSORT) (C) HEWLETT-PACKARD CO. 1980 WED, MAR 11, 1981, 9:21 AM 00000HSORTR 4A X 33 00005I C 33NECX 00010FNC 6 9 Specifications 0002OFDC 1 32 from TSTSPEC 0003OFDV * RECORDS READ = 5 RECORDS SELECTED & SORTED = 4 NUMBER OF COMPARES = 7 SCRATCHFILE I/O = 2 CPU SECONDS = .339 ELAPSED SECONDS = 1.447 TOTAL CPU SECONDS = 1.116 END OF PROGRAM :SAVE TSTOUT Example 5: Using XSORTEXT, Case 2 Single input to different output. Input from $STDIN and output to $STDLIST. The file equation--XSORTIN=$STDIN, in this example--means the program does not know in advance how many records are to be sorted since input is not from a disk file. As a result, it is necessary to enter an S Option line, specifying "Maximum number of records to be sorted" in columns 10-16. :PURGE TSTOUT :FILE XSORTIN=$STDIN :FILE XSORTOUT=$STDLIST .FILE XSORTEXT=TSTSPEX :RUN XSORT.PUB.SYS HP32104A.05.00 EXTRA FUNCTION SORT FOR RPG/3000 (XSORT) (C) HEWLETT-PACKARD CO. 1980 WED, MAR 11, 1981, 9:24 AM 00000HSORTR 4A X 33 00000S Y 35 00005I C 33NECX Specifications 00010FNC 6 9 from TSTSPEX 00020FDC 1 32 00030FDV * AB123GSD212345 JONES X AB234CICO12345 ALBERS Interactive AC102GSD100001 WOODSON input from AC321ABCD10001 FRANKEN $STDIN BB222CICO12345 WOODS :EOD AC321ABCD10001 FRANKEN * AB234CICO12345 ALBERS * Output to BB222CICO12345 WOODS * $STDLIST AC102GSD100001 WOODSON * RECORDS READ = 5 RECORDS SELECTED & SORTED = 4 NUMBER OF COMPARES = 7 SCRATCHFILE I/O = 2 CPU SECONDS = .000 ELAPSED SECONDS = 101.440 TOTAL CPU SECONDS = 1.220 END OF PROGRAM Example 6: Job stream With Specifications Imbedded Single file, in place sort. !JOB TSTXSRT6,MGR.SUBSYS,XSORT;OUTCLASS=,1 !COMMENT THIS IS A SINGLE FILE, INPLACE SORT !COMMENT THAT IS STREAMED. SPECS ARE IMBEDDED. !COMMENT************************************** !COMMENT************************************** !FCOPY FROM=TSTIN;TO= !FILE XSORTIN=TSTIN !FILE XSORTOUT=TSTIN !RUN XSORT.PUB.SYS 00000HSORTR 4A X 33 00005I C 33NECX Specifications 00010FNC 6 9 imbedded in 0002OFDC 1 32 job stream 0003OFDV * EDITOR file !FCOPY FROM=TSTIN;TO= !EOJ 1. No purge of the XSORTOUT file is required. 2. XSORTIN and XSORTOUT are both equated to TSTIN because this is an inplace sort. Example 7: Job Stream With Specifications Imbedded. Single file to different output that already exists. !JOB TSTXSRT7,MGR.SUBSYS,XSORT;OUTCLASS=,1 !COMMENT THIS IS AN EXAMPLE OF A SINGLE SORT FILE TO !COMMENT DIFFERENT OUTPUT THAT ALREADY EXISTS. !COMMENT IT IS STREAMED, SPECS IMBEDDED !COMMENT ************************************** !COMMENT ************************************** !FCOPY FROM=TSTIN;TO= !FCOPY FROM=TSTFILE;TO= !FILE XSORTIN=TSTIN !FILE XSORTOUT=TSTFILE !RUN XSORT.PUB.SYS 00000HSORTR 4A X 33 00000S Y Specifications 00005I C 33NECX imbedded in 00010FNC 6 9 job stream 00020FDC 1 32 EDITOR file 00030FDV * !FCOPY FROM=TSTFILE;TO= !EOJ 1. No purge of the XSORTOUT file is required. 2. In this sort, the S Option must be employed to allow the program to overlay the existing file, TSTFILE.
NOTE After this job is run, the old contents of TSTFILE will have been erased, and replaced by the same output data produced by the other examples.
Example 8: Job Stream With Specifications Imbedded. Multiple input file. !JOB TSTXSRT8,MGR.SUBSYS,XSORT;OUTCLASS=,1 !COMMENT THIS IS A SORT USING MULTIPLE- !COMMENT INPUT FILES. IT IS STREAMED,SPECS !COMMENT IMBEDDED.************************ !COMMENT ********************************* !FCOPY FROM=TSTIN1;TO= !FCOPY FROM=TSTIN2;TO= !FCOPY FROM=TSTIN3;TO= !PURGE TSTOUT !FILE XSORTIN1=TSTIN1 Multiple input !FILE XSORTIN2=TSTIN2 file designators !FILE XSORTIN3=TSTIN3 !FILE XSORTOUT=TSTOUT !RUN XSORT.PUB.SYS 00000HSORTR 4A X 33 00000S Y 35 Specifications 00005I C 33NECX imbedded in 00010FNC 6 9 job stream 00020FDC 1 32 EDITOR file 00030FDV * !EOD !SAVE TSTOUT !FCOPY FROM=TSTOUT;TO= !EOJ 1. S Option is used to provide the maximum number of records to be sorted.
NOTE The example uses XSORTIN1, XSORTIN2, etc. In a multiple input sort, XSORTIN cannot be used to designate an input file. Input files must begin with XSORTIN1, but may skip numbers. For example, XSORTIN3 could follow XSORTIN1.
Example 9: SORTC (Count-Only Sort) Single input file, no output. !JOB TSTXSRT9,MGR.SUBSYS,XSORT;OUTCLASS=,1 !COMMENT THIS IS AN EXAMPLE OF A COUNT-ONLY SORT FROM !COMMENT WHICH THERE IS NO OUTPUT OTHER THAN A STATISTICAL !COMMENT REPORT ON THE RECORDS SELECTED TO SORT.******* !COMMENT************************************************ !FCOPY FROM=TSTIN;TO= !FILE XSORTIN=TSTIN !RUN XSORT.PUB.SYS Specifications 00000HSORTC imbedded in 000051 C 33NECX job stream !EOD EDITOR file !EOJ 1. No purge of the XSORTOUT file is required. 2. No output file is designated since there is only a statistical report produced by a SORTC on the records selected for processing.
NOTE Count-only (SORTC) can also be used with multiple file sorts. See Example 8 for uses of multiple input files (XSORTIN1...XSORTING). You can combine the commands in Example 8 with those above to produce a Count-only, multiple file sort.
Here is a physically condensed copy of Example 9 after it was run. Note the statistical report on the records sorted. :JOB TSTXSRT9,MGR.SUBSYS,XSORT PRIORITY = DS; INPRI = 8; TIME = UNLIMITED SECONDS JOB NUMBER = #J58 WED, MAR 11, 1981, 9:40 AM HP3000 / MPE IV C.00.P8 D U K E :COMMENT THIS IS AN EXAMPLE OF A COUNT-ONLY SORT FROM :COMMENT WHICH THERE IS NO OUTPUT OTHER THAN A STATISTICAL :COMMENT REPORT ON THE RECORDS SELECTED TO SORT.******* :COMMENT************************************************ :FCOPY FROM=TSTIN;TO= HEWLETT-PACKARD 32212A.3.13 FILE COPIER WED, MAR 11, 1981, 9:40 AM (C) HEWLETT-PACKARD CO. 1980 *200* WARNING: FROMFILE RECSIZE IS 72 BYTES, TOFILE RECSIZE IS 133 BYTES. AB123GSD212345 JONES X AB234CICO12345 ALBERS AC102GSD100001 WOODSON AC321ABCD10001 FRANKEN BB222CICO12345 WOODS EOF FOUND IN FROMFILE AFTER RECORD 4 5 RECORDS PROCESSED *** 0 ERRORS END OF SUBSYSTEM :FILE XSORTIN=TSTIN :RUN XSORT.PUB.SYS HP32104A.05.0O EXTRA FUNCTION SORT FOR RPG/3000 (XSORT) (C) HEWLETT-PACKARD CO. 1980 WED, MAR 11, 1981, 9:40 AM 00000HSORTC 00005I C 33NECX RECORDS READ = 5 RECORDS SELECTED = 4 Statistics TOTAL CPU SECONDS = .224 END OF PROGRAM :EOJ CPU SEC. = 4. ELAPSED MIN. = 1. WED, MAR 11, 1981, 9:41 AM


MPE/iX 5.0 Documentation