Help using Base SAS procedures

Working with COBOL files in SAS

Accepted Solution Solved
Reply
Contributor
Posts: 32
Accepted Solution

Working with COBOL files in SAS

Hello Community,


we need to import a TSO data file with packed fields. It is located on a host with OS390. We transfer it per ftp to the SAS server (with UNIX OS).

This is my current routine to import the files:

%let PFAD_BILANZWERTE = "/appdata/sas/fb_daten/vrm/lp/lf/inte/BIL_032015.bin";

data BILGEWZER;  

infile &PFAD_BILANZWERTE.          

encoding="ebcdic500"       

lrecl=1152          

recfm=F          

blksize=27648;   

input          

MONAT                                    S370FIBU2.

VSNR                                       $EBCDIC11.

@22        AENDDAT                 $EBCDIC10.

@32        AENDGRU                $EBCDIC4.

@38        AENDBUCH_HHJJ   $EBCDIC4.

@42        AENDBUCH_MM     $EBCDIC2.

@48        MVANT                     S370FPD5.6

@89        BGKZ                        $EBCDIC3.

@230      DRZ                          S370FPD8.2

@238      DRP                          S370FPD8.2

@246      DRA                          S370FPD8.2

@931      VTID                          S370FPD3.;

run;

I would like to optimize this routine. My preferred solution would be to supply the COBOL copy member of this file to SAS such that SAS knows where the fields start, end and which format they are on its own. Is this possible?

Has anyone experience with such files?

Thank you in advance!


Accepted Solutions
Solution
‎02-09-2015 09:15 AM
Contributor tlk
Contributor
Posts: 53

Re: Working with COBOL files in SAS

There was a macro to do this  http://ftp.sas.com/techsup/download/technote/ts620.html , it dates to version 8 but it should work.

View solution in original post


All Replies
Super User
Posts: 7,112

Re: Working with COBOL files in SAS

You would need to write a data step that reads the COBOL definitions, and generates the input statement from that.

This data step could either write an external file that you later use with %include, or generate the data step to read the TSO file by using call execute.

Since you use FTP, you could also read the file directly from the z/OS mainframe with filename ftp. Saves the external FTP transfer and the disk space needed for the transferred file.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Solution
‎02-09-2015 09:15 AM
Contributor tlk
Contributor
Posts: 53

Re: Working with COBOL files in SAS

There was a macro to do this  http://ftp.sas.com/techsup/download/technote/ts620.html , it dates to version 8 but it should work.

🔒 This topic is solved and locked.

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

Discussion stats
  • 2 replies
  • 352 views
  • 4 likes
  • 3 in conversation