Reading Mainframe file via EG Linux

Accepted Solution Solved
Reply
Contributor
Posts: 30
Accepted Solution

Reading Mainframe file via EG Linux

(1)  I have a column of data that looks has either a positive amount or a negative number.  The data is suppose to be formatted 12.2
For example: 
FRED        000002300086
BARNEY   -99999999999

Fred's amount     =         23,000.86   and
Barney's amount =  -99999999.99

The Variable Name that I am having trouble with is:  TotalRewardCash shown below.

(2) A second question I have is the Variable PeriodId is yyyymmdd and I would like to read it in as a date, but couldn't find an ebcdic format that would work properly.

DATA CCARD_RAW_DATA;

   INFILE COMMCARD;

   INPUT

@1 ReferenceNumber         $EBCDIC12.

@13 CustomerID                 $EBCDIC12.

@25 BankId                         $EBCDIC12.

@37 PeriodId                       $EBCDIC8.   

@135 TotalRewardCash      S370FZDU12.2 ;

RUN;

I have tried many informats but this one gets me the closest.  It brings in the numbers but will not bring in the leading negative sign.

I have tried   S370FZDL12.2 but then I get nothing.

Does anyone have any suggestions?

Thanks.


Accepted Solutions
Solution
‎05-30-2014 12:05 PM
Contributor
Posts: 30

Re: Reading Mainframe file via EG Linux

Update...

I got it to work...   The INFORMAT can be 12.2 but then I need to FORMAT it bigger....  14.2 to fit the decimal sign and the leading minus sign... YAY!!!   

View solution in original post


All Replies
Valued Guide
Posts: 3,208

Re: Reading Mainframe file via EG Linux

When you are running this code in a mainframe you do not the $EBCDIC coding the $ coding will do as Ebcdic is default in z/OS.
When you have downloaded the file binary, beware of record formats. Sometimes you get trapped by cr/lf characters as part of numeric values.

There are several dedicated numeric formats at z/OS.

- floating often not used with Cobol.

- packed (with signs) the two digits are getting compressed by their hexadecimal representation
- Zoned  (with signs) the digits are not compressed but the last digit is with the sign.
- character based. Similar to zoned but not having signs. It is more a constraint on some values on the used chars. 

You have used the unsigned zoned type. No wonder you no signs

SAS(R) 9.4 Formats and Informats: Reference  S370FZDw.d Informat is most common. Watch the notes on the used Cobol Picture. When you know that one you are sure wich format to be used.

---->-- ja karman --<-----
Contributor
Posts: 30

Re: Reading Mainframe file via EG Linux

I am not using Mainframe SAS to read the file.   I use Enterprise Guide interface and read the Mainframe file via FTP statement.  That is why I need to use the EBCDIC informats to read my data in.  Otherwise I get gibberish.

I have tried all of the file formats listed and none of them get me the desired results.

I will review the website to see if I missed any.  Thanks anyway..

Solution
‎05-30-2014 12:05 PM
Contributor
Posts: 30

Re: Reading Mainframe file via EG Linux

Update...

I got it to work...   The INFORMAT can be 12.2 but then I need to FORMAT it bigger....  14.2 to fit the decimal sign and the leading minus sign... YAY!!!   

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 396 views
  • 0 likes
  • 2 in conversation