Use SAM() to perform I/O operations on sequential and partitioned data sets.
The SAM() function has this syntax:
Form 1:
dcb = SAM(OBTAIN,[scope],ddname,[use])
Form 2:
SAM(action1,dcb)
Form 3:
SAM(RELEASE,dcb)
Form 4:
record = SAM(GET,dcb)
Form 5:
SAM(PUT,dcb,record,[pad])
Form 6:
SAM(OPTION,dcb,[recfm1,][lrecl],[blksize])
Form 7:
SAM(FIND,dcb,member)
Form 8:
ttr = SAM(NOTE,dcb)
Form 9:
entry = SAM(BLDL,dcb,member)
Form 10:
entry = SAM(STOW,dcb,member,[ttr],[action2],[ALIAS],[newname],[ttrn],[data])
Form 11:
state = SAM(STATUS,dcb)
Form 12:
dsorg recfm2 lrecl blksize = SAM(INFO,dcb)
The SAM() function takes these arguments:
Value that identifies a file and an associated internal workspace.
Obtains a new DCB.
Scope of the data set. Specify one of the following:
Indicates that the file DCB is local to the IMOD; the DCB is automatically closed, and the DCB is released at the conclusion of the IMOD. LOCAL is the default.
Indicates that the file is not automatically closed and the DCB is not automatically freed at IMOD termination. Instead, other IMODs can use the DCB to continue processing the same data set. Only one IMOD task can use the GLOBAL DCB at a time. GLOBAL files must be explicitly closed, and the DCBs must be explicitly freed.
The SAM() function produces these return codes:
101 - 109 ARG n MISSING OR INVALID
121 ALREADY OPEN
122 OPEN FAILED
123 FILE NOT OPEN
124 FILE OPEN FOR OUTPUT
125 ATTEMPTING TO READ PAST EOF
126 EOF
127 FILE OPEN FOR INPUT
128 INVALID FILE HANDLE
129 FILE NOT CLOSED
130 MEMBER NOT FOUND
131 DATASET NOT PARTITIONED
132 TRUNCATED
133 INVALID FILE HANDLE
134 READ FAILURE
135 DUPLICATE NAME
136 MEMBER NOT FOUND
137 NO DIRECTORY SPACE
138 PERMANENT I/O ERROR
139 DCB CLOSED OR OPEN FOR INPUT
140 INSUFFICIENT VIRTUAL STORAGE
141 STOW FAILED
142 NOTE FAILED
143 LRECL IS INVALID
144 BLKSIZE IS INVALID
145 RECFM IS UNDEFINED
146 LRECL IS UNDEFINED
147 BLKSIZE IS UNDEFINED
148 DDNAME MISSING
To add a member to the PDS
Example
/* DD name JUNK was already allocated */
dcb = sam('OBTAIN',,'JUNK','PDSIN') /* Obtain a dcb for a PDS */
sam('open',dcb) == '' /* Open the PDS */
sam('find',dcb,'QSGSS') == '' /* Find the member QSGSS */
sam('get',dcb) == 'The first record of the member' /* Get record */
/* The next two calls are automatically done at IMOD end */
sam('close',dcb) == '' /* Clean up */
sam('release',dcb) == '' /* Clean up */
If you consider the physical structure of a PDS, you will quickly see that it is not possible simply to add data to the end of a member. Such data would overlay the next physical member. However, the following procedure permits you to simulate appending data to a PDS member:
| Copyright © 2011 CA. All rights reserved. | Tell Technical Publications how we can improve this information |