CA_CA
CA_CA

Reputation: 143

Cobol number format

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

Upvotes: 1

Views: 733

Answers (2)

Joe Zitzelberger
Joe Zitzelberger

Reputation: 4263

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.

Upvotes: 2

Stig Eide
Stig Eide

Reputation: 1062

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.

Upvotes: 1

Related Questions