Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Transferring records to a residual file

&pagelevel(3)&pagelevel

All records of a file that contain “MANCHESTER” as the town name are to be transferred to the file PERS.MANCHESTER, those with “NORWICH” as the town entry are to be transferred to the file PERS.NORWICH. The remaining records are to be transferred to the file REST-OF-THE-WORLD.
The name of the input file is PERS.DPT.1.

Tracer listing:

/CREATE-FILE FILE-NAME=PERS.MANCHESTER &*————————————————————————————————  (1)
/ADD-FILE-LINK -
/   FILE-NAME=PERS.MANCHESTER,SUPPORT=*DISK,-
/   LINK-NAME=OUT1,ACCESS-METHOD=*SAM
/CREATE-FILE FILE-NAME=PERS.NORWICH
/ADD-FILE-LINK -
/   FILE-NAME=PERS.NORWICH,SUPPORT=*DISK,-
/   LINK-NAME=OUT2,ACCESS-METHOD=*SAM
/CREATE-FILE FILE-NAME=REST-OF-THE-WORLD
/ADD-FILE-LINK -
/   FILE-NAME=REST-OF-THE-WORLD,SUPPORT=*DISK,-
/   LINK-NAME=OUT3,ACCESS-METHOD=*SAM
/START-PERCON &*—————————————————————————————————————————————————————————  (2)
%  PER0000 PERCON STARTED, VERSION V03.0A00
//ASSIGN-INPUT-FILE - &*—————————————————————————————————————————————————  (3)
//   FILE=*DISK-FILE(NAME=PERS.DPT.1),- 
//   LINK-NAME=IN1
//ASSIGN-OUTPUT-FILE - &*————————————————————————————————————————————————  (4)
//   FILE=*DISK-FILE(NAME=PERS.MANCHESTER),-
//   LINK-NAME=OUT1
//ASSIGN-OUTPUT-FILE - &*————————————————————————————————————————————————  (5)
//   FILE=*DISK-FILE(NAME=PERS.NORWICH),- 
//   LINK-NAME=OUT2
//ASSIGN-OUTPUT-FILE - &*————————————————————————————————————————————————  (6)
//   FILE=*DISK-FILE(NAME=REST-OF-THE-WORLD),-
//   LINK-NAME=OUT3
//SELECT-INPUT-RECORDS - &*——————————————————————————————————————————————  (7)
//   OUTPUT-LINK-NAME=OUT1,-
//   CONDITION=((29,10)='MANCHESTER ') 

(1)

The /ADD-FILE-LINK command defines the three output files including their file attributes.

(2)

PERCON is called.

(3)

The input file PERS.DPT.1 is assigned with the link name IN1.

(4)

The output file PERS.MANCHESTER is assigned with the link name OUT1.

(5)

The output file PERS.NORWICH is assigned with the link name OUT2.

(6)

The output file REST-OF-THE-WORLD is assigned with the link name OUT3.

(7)

The SELECT-INPUT-RECORDS statement selects all records containing the entry C'MANCHESTER' starting at column 29. The records are transferred to the output file with the link name OUT1.

//SELECT-INPUT-RECORDS - &*——————————————————————————————————————————————  (8)
//   OUTPUT-LINK-NAME=OUT2,-
//   CONDITION=((29,7)='NORWICH')
//SELECT-INPUT-RECORDS - &*——————————————————————————————————————————————  (9)
//   OUTPUT-LINK-NAME=OUT3,-
//   CONDITION=*REMAINING-RECORDS
//END &* ———————————————————————————————————————————————————————————————— (10)
%  PER0030 NUMBER OF PROCESSED RECORDS FOR LINK='IN1' 
           (FILE=:2OS6:$WKST.PERS.DPT.1):                   8  —————————— (11)
%  PER0030 NUMBER OF PROCESSED RECORDS FOR LINK='OUT1'
           (FILE=:2OS6:$WKST.PERS.MANCHESTER):                   5
%  PER0030 NUMBER OF PROCESSED RECORDS FOR LINK='OUT2'
           (FILE=:2OS6:$WKST.PERS.NORWICH):                   1
%  PER0030 NUMBER OF PROCESSED RECORDS FOR LINK='OUT3'
           (FILE=:2OS6:$WKST.REST-OF-THE-WORLD):                   2
%  PER0031 PERCON TERMINATED NORMALLY ——————————————————————————————————— (12)

(8)

The SELECT-INPUT-RECORDS statement selects all records containing the entry C'NORWICH' starting at column 29. The records are transferred to the output file with the link name OUT2.

(9)

The SELECT-INPUT-RECORDS statement defines the file with the link name OUT3 as residual file i.e. the file to which all input records are to be transferred that do not contain either of the entries C'MANCHESTER' or C'NORWICH' starting at column 29.

(10)

The END statement starts the transfer operation and terminates PERCON. Any records not transferred to either of the output files with the link names OUT1 and OUT2 are transferred to the output file with the link name OUT3.

(11)

PERCON messages: The number of records transferred per file is output.

(12)

PERCON was terminated normally.

Printout of the file PERS.MANCHESTER
BELL        JOHN        MANCHESTER     BOLSOVER STREET 4        DPT1
BOTHAM      NORMAN      MANCHESTER     TOWER AVENUE 10          DPT2
LAKER       ERICA       MANCHESTER     BANK DRIVE 8             DPT1
PRICE       ALFRED      MANCHESTER     THAMES ROAD 4            DPT1
WILSON      RICHARD     MANCHESTER     ACACIA AVENUE 24         DPT3
Printout of the file PERS.NORWICH
FINN        SUSANNA     NORWICH        ROSE STREET 11           DPT2
Printout of the file REST-OF-THE-WORLD
GREENE      WALTER      BURY           SINCLAIR CRESCENT 7      DPT1
KING        MONICA      FALMOUTH       INMAN SQUARE 61          DPT3