|
SELCOPY
Examples Menu
We will print a sample of a DL1/IMS Data Base, together with Segment names
and Level numbers, restricting the print to the first 50 segments.
For clarity, we will space a line on the print every time we hit a
Root Segment which is identified by a Level number of 01 in the PCB
feedback area.
Fields in DL1's PCB may be referenced using SELCOPY's positional keywords:
| Keyword
| Description
| Length
| Type |
| POS PCB
|
Database Name
| 8
| Char |
| POS PCB+8
|
Seg Level
| 2
| ZonedDec |
| POS PCB+10
|
Status Code
| 2
| Char |
| POS STATUS
|
Synonym for PCB+10
|
| |
| POS PCB+12
|
Processing Options
| 4
| Char |
| POS PCB+16
|
Reserved
| 4
|
|
| POS PCB+20
|
Segment Name
| 8
| Char |
| POS SEG
|
Synonym for PCB+20
|
| |
| POS PCB+28
|
Length of Key
| 4
| Binary |
| POS PCB+32
|
No of Sensitive Segs
| 2
| Binary |
| POS PCB +36 |
Key Feedback Area
| Var
| Char |
We will use a work area (automatically initialised to blanks by SELCOPY)
which is larger than the largest record, and read segments (records) into
position 101.
But segments shorter than 100 bytes may have residual data still in the
work area from the last segment. This must be cleared with blanks before
printing.
POS LRECL in SELCOPY refers to the last byte of the current input record
assuming it was read into position 1, but in our case, we read our record
into a position 100 bytes further on, so LRECL+100 is the last byte of the
current record. It is therefore position LRECL+101 which needs to be
blanked. L+101 is a valid abbreviation.
After moving in the Segment Name and Level no to the front of the work
area, we will print it, restricting the print length to 200 and spacing one
line first if we have a root segment to print. In spite of the restriction
of L=200 on the PRINT command, it is still the true segment length of each
individual segment which is printed on the right hand side of the SELCOPY
report.
The Status Code is not checked because EOF is handled automatically by
SELCOPY as well as any major error conditions.
SELCOPY Control Cards
read DBNAME DL1 into 101 w 2222 * Work area length 2222.
pos L+101,200 = ' ' * Blank out residual data.
move 2 fr pcb+8 to 1 * Segment Level No.
move 8 fr seg to 10 * Segment Name.
if pos pcb+8 = '01' * Is it a Root Segment?
t space 1 * Extra blank line.
t p 20 = '*=* ROOT SEGMENT OF DB xxxxxxxx *=*'
t move 8 fr pcb to 43 * Data Base name.
else pos 20,80 = ' '
print L 200 s 50 * First 50 segs, length 100.
Notes
SELCOPY treats lower case as upper case unless in 'quotes'.
Some common abbreviations are:
rd read w worklen fr from l lrecl b blksize t then
pr print p pos ty type s stopaft li elseif ti thenif
Change "t space 1" to "t
line 1" to force a new page.
You could also display the Processing Options.
Use POS PCB+12.
|