Loading...
Select Version
&pagelevel(5)&pagelevel
The following examples demonstrate the principles underlying SDF function calls in the programming languages COBOL and FORTRAN.
Use of the COBOL interface (program excerpt)
. . DATA DIVISION. WORKING-STORAGE SECTION. *work variable 01 SDF-DATA 02 SDF-INIT PIC X(4) VALUE "INIT". 02 SDF-READ PIC X(4) VALUE "READ". 02 SDF-STMT PIC X(4) VALUE "STMT". 02 SDF-TYPE PIC X(4) VALUE "TYPE". 02 SDF-VAL PIC X(4) VALUE "OPER". 02 SDF-TYP PIC 9(6) COMP. 02 SDF-LNG PIC 9(6) COMP. 02 SDF-POS PIC 9(6) COMP. 02 SDF-LST PIC 9(6) COMP. 02 SDF-ERR PIC S9(6) COMP. 02 SDF-STMT PIC X(8). 02 SDF-PROG PIC X(8). 77 BUF PIC X(500). 77 MAX PIC 9(6) COMP VALUE 500. 01 VAL. 02 FILLER PIC X OCCURS 1 TO 50 DEPENDING ON SDF-LNG. . . * PROCEDURE DIVISION. * *INIT * MOVE "TEST" TO SDF-PROG. CALL "SDF" USING SDF-INIT, BUF, SDF-ERR, MAX, SDF-PROG. * *READ * CALL "SDF" USING SDF-READ, BUF, SDF-ERR. * *STMT * CALL "SDF" USING SDF-STMT, BUF, SDF-ERR, SDF-STMT. * *TYPE * CALL "SDF" USING SDF-TYPE, BUF, SDF-ERR, SDF-POS, SDF-TYP, SDF-LNG. * *VAL * CALL "SDF" USING SDF-VAL, BUF, SDF-ERR, SDF-POS, VAL, SDF-LNG. . .
The program must be linked with the library SYSLIB.SDF.<version> (e.g. SYSLIB.SDF.048 for SDF V4.8). This library includes, among other things, a COBOL copy element containing the description of the SDF declarations (type S member SDFCOPY).
Use of the FORTRAN interface (program excerpt)
. . C*****Work variable CHARACTER*4 SDF$INIT/'INIT'/ CHARACTER*4 SDF$READ/'READ'/ CHARACTER*4 SDF$STMT/'STMT'/ CHARACTER*4 SDF$VAL/'OPER'/ CHARACTER*4 SDF$TYPE/'TYPE'/ INTEGER SDF$LNG,SDF$POS,SDF$LST,SDF$TYP,SDF$ERR CHARACTER*8 SDF$STMT,SDF$PROG CHARACTER*500 AREA,VAL*50 INTEGER MTYP(2),MLNG(2) * *INIT * CALL SDF(SDF$INIT,AREA,SDF$ERR,500,'TEST'BLANK''BLANK''BLANK''BLANK'') * *READ * CALL SDF(SDF$READ,AREA,SDF$ERR) * *STMT * CALL SDF(SDF$STMT,AREA,SDF$ERR,SDF$STMT) * *TYPE * CALL SDF(SDF$TYPE,AREA,SDF$ERR,SDF$POS,SDF$TYP,SDF$LNG) * *VAL * CALL SDF(SDF$VAL,AREA,SDF$ERR,SDF$POS,VAL,SDF$LNG) . .
The program must be linked with the library SYSLIB.SDF.<version> (e.g. SYSLIB.SDF.048 for SDF V4.8). This library includes, among other things, a FORTRAN include element containing the description of the SDF declarations (type S member SDFINCL).