|
COB2SAS is a sample program provided by SAS Institute Inc. as a tool that can assist you in converting COBOL language data description entries into equivalent SAS language statements. It is provided "as is". There are no warranties, express or implied, including merchantability or fitness for a particular purpose, regarding the accuracy of the materials or code contained herein. COB2SAS is designed to read as it's input a COBOL program or copybook. It parses the COBOL code looking for the file descriptor section. When it finds it, COB2SAS translates the file descriptor into a SAS INPUT statement and LABEL statement. The LABEL statement associates the long COBOL variable names with the SAS variable names. SAS variable names are limited to 8 characters. By default this INPUT and LABEL statement are written to the SASLOG. This behavior can be changed to write them to flat files. The required modifications will be discussed in this document. In the process of generating the INPUT and LABEL statement, SAS creates a SAS dataset that contains all the information that we found about the COBOL variables. Each COBOL variable will be represented by 1 observation in this SAS dataset. This dataset is called the DICTNRY dataset. By default this dataset is written to the work library. This behavior can be changed so that the DICTNRY dataset is saved to a permanent SAS dataset. On VSE, the COB2SAS programs are contained in the VSE sublibrary known as ulib.usub in the install process. The documentation for COB2SAS is also contained in this sublibrary. The following members are the documentation members :
To invoke COB2SAS you must assign a fileref called INCOBOL to the COBOL program or copybook. Because COB2SAS is designed to work on many platforms, and because VSE libraries only exist on VSE, COB2SAS is not designed to read or write to VSE libraries without making big modifications to COB2SAS. The SAS System under VSE can write and read members in VSE libraries, but COB2SAS is not designed to. If your copybook is stored in a VSE library, you must add a step (SAS or 3rd party) before COB2SAS to copy it into either a file in VSAM/SAM space, Sequential Disk space, or EPIC/DYNAM/D managed space. The following is the JCL that would invoke COB2SAS on VSE : * $$ JOB JNM=COB2SAS,.. power options...
* $$ LST ... power options...
// JOB COB2SAS
/*
// DLBL INCOBOL,'your.cobol.copybook',,VSAM,CAT=usercat
/*
// EXEC PROC=sas
FILENAME S SUBLIB=ulib.usub;
OPTIONS NONOTES NOSOURCE NOSOURCE2;
%INCLUDE S(R2VSE);
RUN;
PROC PRINT DATA=DICTNRY;
FORMAT RDF_NAME $8.;
BY FILENAME NOTSORTED;
ID LEVEL;
VAR NST_DPTH NEWNAME USAGE PICTURE INFMT ATBYTE BYTES
OCR_VAL RDF_NAME;
RUN;
/*
/&
* $$ EOJ
This program will write the INPUT and LABEL statement in the SASLOG. As you can see, the output that is generated in SASLIST is a PROC PRINT of certain fields from the DICTNRY SAS dataset. If you want to write the INPUT and LABEL statements to flat files you must allocate 2 filerefs in JCL (OUTSAS1 and OUTSAS2) pointing to flat files. You must also make changes to the R2VSE.SAS member stored in ULIB.USUB. Locate the following line in the R2VSE.SAS member, and remove the asterisk (*) from this line. * %LET FILE = FILE OUTSAS1 &&DCB; Next locate the following line in the R2VSE.SAS member, remove the asterisk (*) from this line, and then save the member. * %LET FILE = FILE OUTSAS2 &&DCB; With these changes, the INPUT statement will be written to the file pointed to by OUTSAS1, and the LABEL statement will be written to the file pointed to by OUTSAS2. In order to save the DICTNRY SAS dataset to a permanent SAS dataset you must first allocate a fileref in jcl called PERM. You must then modify the R2VSE.SAS member in ulib.usub.First locate the following line hen save the file : * %LET LIBREF = PERM.; Since PERM is a SAS data library, you will have to initialize it on the first run of COB2SAS with the above change made. You must have a DLBL to allocate the permanent SAS dataset with a disposition of "new". You must also provide a LIBNAME statement with a DISP=NEW coded in the SAS source code. You will only have to initialize the SAS data library the first time you access it. The following JCL allocates OUTSAS1 and OUTSAS2 to hold the INPUT and LABEL statements. It also allocates PERM as a new file in VSAM/SAM managed space. The SAS source code contains a LIBNAME statement to tell SAS that this is a new library and needs to be initialized. You will have to run something similar to this the first time you run COB2SAS with the permanent SAS data library to hold the DICTNRY SAS dataset. * $$ JOB JNM=COB2SAS,.. power options...
* $$ LST ... power options...
// JOB COB2SAS
/*
// DLBL INCOBOL,'your.cobol.copybook',,VSAM,CAT=usercat
// DLBL OUTSAS1,'your.flat.file.for.input',,VSAM,CAT=usercat
// DLBL OUTSAS2,'your.flat.file.for.label',,VSAM,CAT=usercat
// DLBL PERM,'your.sas.data.library',0,VSAM, C
CAT=usercat,RECSIZE=6144, C
RECORDS=(50,20),DISP=NEW
/*
// EXEC PROC=sas
FILENAME S SUBLIB=ulib.usub;
OPTIONS NONOTES NOSOURCE NOSOURCE2;
LIBNAME PERM DISP=NEW;
%INCLUDE S(R2VSE);
RUN;
PROC PRINT DATA=DICTNRY;
FORMAT RDF_NAME $8.;
BY FILENAME NOTSORTED;
ID LEVEL;
VAR NST_DPTH NEWNAME USAGE PICTURE INFMT ATBYTE BYTES
OCR_VAL RDF_NAME;
RUN;
/*
/&
* $$ EOJ
After you run this once, the PERM SAS dataset is initialized. From that point on, you can modify the DLBL so that it points to the existing file. You can also remove the LIBNAME statement from the SAS source code. Here is an example of what the JCL would look like after the library has been initialized. * $$ JOB JNM=COB2SAS,.. power options...
* $$ LST ... power options...
// JOB COB2SAS
/*
// DLBL INCOBOL,'your.cobol.copybook',,VSAM,CAT=usercat
// DLBL OUTSAS1,'your.flat.file.for.input',,VSAM,CAT=usercat
// DLBL OUTSAS2,'your.flat.file.for.label',,VSAM,CAT=usercat
// DLBL PERM,'your.sas.data.library',,VSAM,CAT=usercat
/*
// EXEC PROC=sas
FILENAME S SUBLIB=ulib.usub;
OPTIONS NONOTES NOSOURCE NOSOURCE2;
%INCLUDE S(R2VSE);
RUN;
PROC PRINT DATA=DICTNRY;
FORMAT RDF_NAME $8.;
BY FILENAME NOTSORTED;
ID LEVEL;
VAR NST_DPTH NEWNAME USAGE PICTURE INFMT ATBYTE BYTES
OCR_VAL RDF_NAME;
RUN;
/*
/&
* $$ EOJ
If you have any questions or problems running COB2SAS at your site, please contact SAS Institute's Technical Support Department at 919-677-8008. If you have an existing tracking number, please give them the tracking number. If you have no tracking number, then tell them that you have questions about running COB2SAS under the VSE operating system, and you will be transferred to someone in the mainframe systems group. |