SELCOPY
Examples Menu
For many applications, you will need more space than taken up by your file
input record in order to store and manipulate data or counters, build new
records etc...
For this purpose SELCOPY enables you to request a number of
bytes which can be used as a sort of "scratch pad".
RD INFILE WORKLEN 300 * Read a record (say Lrecl=150) into POS 1
IF POS 10 NE POS 201 LEN 4 * Test for a change in Cost Centre.
THEN MOVE 4 FR 10 TO 201 * Store in workarea for comparison.
THEN PR FR 201 L 4 * Print list of different Cost Centres.
In this example we read a file of records sorted by Cost Centre code, held
in a 4 byte alpha-numeric field at position 10, and print out a list of
each different code.
|