18.08.2013 Views

(SYSLIB) Programming Reference Manual - Public Support Login ...

(SYSLIB) Programming Reference Manual - Public Support Login ...

(SYSLIB) Programming Reference Manual - Public Support Login ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

BSP$-Program File Basic Service Package<br />

Example of Using CPTNL$<br />

The following example uses CPTNL$ to search the COBOL procedure table:<br />

$INCLUDE 'MAXR$' .<br />

$(0) .<br />

FCT $RES 34 . File control table<br />

CPTBL $RES 252 . Buffer for COBOL procedure table<br />

FILENAME ‘FILE ‘ . Program file name<br />

CPTNUM $EQUF,H2 0213,X1 . Number of 4 word blocks<br />

$(1) .<br />

START .<br />

DL A6,FILENAME . Get file name<br />

DS A6,FCT . Put it in first two words of FCT<br />

L,U A0,FCT . Get address of FCT<br />

LMJ X11,RFTI$ . Read FTI<br />

J BSPERR . Error return<br />

.<br />

L,U A0,FCT . Get address of FCT<br />

L A1,(CPTBL,252) . Get address, length of buffer<br />

LMJ X11,RPFCPT$ . Read COBOL procedure table<br />

J BSPERR . Error return<br />

.<br />

L,U X1,CPTBL . Get address of buffer for CPTNUM<br />

LA,U A7,0 . Initialize loop counter to zero<br />

LOOP .<br />

L,U A0,FCT . Get address of FCT<br />

AA,U A7,1 . Increment loop counter<br />

L A1,A7 . Set sequence number<br />

LMJ X11,CPTNL$ . Get COBOL item for sequence number<br />

J BSPERR . Error return<br />

.<br />

L,S1 A3,3,A0 . Get continuation indicator bit<br />

TOP,U A3,020 . Is it set?<br />

J 4WORDITEM . No, handle 4 word item<br />

AA,U A7,1 . 8 word item, increment loop counter<br />

. to skip reading next 4-word block<br />

. .<br />

. . handle 8-word item<br />

. .<br />

J CHKLOOP . Check for loop termination<br />

4WORDITEM .<br />

. .<br />

. . handle 4-word item<br />

. .<br />

CHKLOOP . Loop termination code<br />

TE A7,CPTNUM . Last 4-word block reached?<br />

J LOOP . No, keep reading<br />

. .<br />

. .<br />

. .<br />

5–20 7833 1733–004

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!