Cobol number format

714 Views Asked by At

I have no experience with COBOL but one of the programs that I need to read in the mainframe with SAS is written in COBOL and I see fields like the following:

Amount 0000000084{ 0000000433F

how can I read this data using SAS commands?

Thanks

2

There are 2 best solutions below

1
On BEST ANSWER

Your SAS format for these two fields would beL

INPUT @08 firstNum zd11.
      @20 secondNum zd11.

This will define "firstNum" and "secondNum" as the zoned data in the line below:

Amount 0000000084{ 0000000433F

I'm assuming the "Amount" started at position one, otherwise you would need to adjust your positioning.

0
On

I have no experience with it, but PROC COPYLIB is a SAS procedure that will read any valid COBOL record layout and produce the following:

1) Generate an equivalent input statement for the processed COBOL record layout.

2) A SAS dataset containing a description of the COBOL record layout. This data set can be used as a data dictionary.

3) COBOL Record Layout Report -- which details the COBOL record layout including the starting position, length, and type for each field within the FD.

4) COBOL/SAS Conversion Report -- which matches the COBOL FD to the generated SAS input statement.