BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
DavidLawrence
Fluorite | Level 6

I have not done this is a long time with sas, I use to have mainframe examples on reading mainframe print line and  search for a string like 'load module' then i know I need to get the next 45 characters which is dataset name and member and them amode and rmode information.

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
SASKiwi
PROC Star

Easy enough. Just use the trailing @ symbol on your INPUT statement to hold that data row for reading further. Just need to know where in the input record 'load module' is located:

input @1 string $11. @;
if string = 'load module' then input @12 string2 $45.;

 

View solution in original post

8 REPLIES 8
SASKiwi
PROC Star

Easy enough. Just use the trailing @ symbol on your INPUT statement to hold that data row for reading further. Just need to know where in the input record 'load module' is located:

input @1 string $11. @;
if string = 'load module' then input @12 string2 $45.;

 

DavidLawrence
Fluorite | Level 6

Thanks it has been 10 years since I coded sas or MXG.

ballardw
Super User

If the information may not be at the start of the string perhaps the input @?

The first input @ is just to read the line of data into the input buffer variable _infile_. Then the value can be searched for information such as with the INDEX function (>0 is just a check for "is present"). The Input @"load module" then finds the position of the text "load module" and starts reading afterward for the number of characters in the format following string (I used 15 as too lazy to type longer example text and datalines sometimes gets picky about length of lines)

data example;
   infile datalines truncover;
   input @;
   if index(_infile_,"load module")>0 then do;
      input @"load module" string $15.;
   end;
   else input;

datalines;
Some sort of text that might contain load module followed by something else
other text not of particular interest or needs other read statement
;
DavidLawrence
Fluorite | Level 6

Sorry for another question. it has been 10 years since i did SAS and MXG.
The report I am reading has information on 2 lines that I want to report on.
How do I do that with SAS, read 1 line get some info then read the next line they output what I had found.

Thanks

DavidLawrence
Fluorite | Level 6

This is my input from Load Module analyzer
I want the dataset, then read till i get the cobol version, etc, else DROP
Load Module S24028.SRCCOMN.PRODA.LOAD.DLN(CONVBDGA) AMODE(31),RMODE(ANY)

Sg Offset Len/Ent Program-ID Trn-Date Program-Description
0 1348 5655G5300 2007/03/28 Enterprise COBOL for z/OS and OS/390

DavidLawrence
Fluorite | Level 6

Help please I did the following and it finds nothing, what am I doing wrong ?

The input is a VBA file 

DavidLawrence_1-1606507646749.png

 

 

DavidLawrence_0-1606507618768.png

 

DavidLawrence
Fluorite | Level 6

Help Please  this is the format of the file I am reading any my code below, it does not output anything.

 

 

DavidLawrence_1-1606509494696.png

 

 

 

DavidLawrence_0-1606509472141.png

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 8 replies
  • 984 views
  • 1 like
  • 3 in conversation