DATA Step, Macro, Functions and more

fetch mainframe IMS data

Reply
Occasional Contributor
Posts: 5

fetch mainframe IMS data

hi 

i can fetch data from ims data through infile stathement. 

 

but some time, segments contain multiple occurrences of data...how sas handle ims data multiple occurrence,

for example below situation

01 Automatic Teller Record

     02 ATM Information

           03 ATM Location (occurs 20 times)

                04 Location

                04 ATM Transaction Information (occurs 7 times)

 

pls share some sample code.

 

thanks...

Trusted Advisor
Posts: 1,554

Re: fetch mainframe IMS data

Posted in reply to murali_vijayend

your input record is probably a variable length and there should be a field containing

the number of occurences (probably binary, one or two bytes).

 

can you post a screenshot or text lines with, at least one record in HEX mode 

and post the record layout

 

 

Occasional Contributor
Posts: 5

Re: fetch mainframe IMS data

Thanks , Am sorry unable to do screen shot, due to security issues.

 

Hi,

 

I am using Mainframe BASE SAS, I can see the COPY LIB.

 

I am using INFILE and input statement to read the data.

 

I am using code like below

 

  data distribc;
     length  $11;
     keep ziprange
           check_amount
            balrange;
     retain ssa1 'CUSTOMER*D '
              ssa2 'CHCKACCT ';
     infile acctsam dli ssa=(ssa1,ssa2) status=st 
            pcbno=3;

Here the CHCKACCT segment contain 2 occurances from position 160 to 320,  i need to read amount field from position 163 to 170, first occurances i need to read as AMT1 and second occurance i need to read as AMT2 , 

 

I could not find any example from here

http://support.sas.com/documentation/cdl/en/acims/62983/HTML/default/viewer.htm#n10w0tj80b27mfn17odm...

 

Thanks.

Super User
Posts: 3,252

Re: fetch mainframe IMS data

Posted in reply to murali_vijayend

If your source data file genuinely has the duplicates you describe, you first need to set some business rules as to how these should be handled. SAS cannot set these rules and we have no knowledge on how they should be handled.

 

I suggest you consult an ATM transaction expert at your bank to advise you on what to do with duplicates (the business rules), then we can talk about how these can be coded in SAS. Remember we know nothing about your data except what you have posted. You need to explain what to do with the duplicates (keep them, discard them, keep some of them, keep the first, keep the last etc...) before we can move forward.

 

As @Shmuel has asked we would also need sample data.

SAS Super FREQ
Posts: 8,864

Re: fetch mainframe IMS data

Hi:
As you know, IMS is a hierarchical database that is an IBM product. So, when you use SAS/Access to IMS, you basically have to traverse the hierarchy from parent to child in order to retrieve the records you want.

I doubt the OP will be able to post IMS data from the database and it wouldn't help anyway, because you'd need SAS/Access to IMS to read the database.

The documentation for SAS/Access to IMS is here: http://support.sas.com/documentation/cdl/en/acims/62983/HTML/default/viewer.htm#p09e9rotuvawsin1bxuo...

If you have issues reading specific IMS mainframe data files, it may be more expedient for you to open a track with Tech Support.

cynthia
Occasional Contributor
Posts: 5

Re: fetch mainframe IMS data

Posted in reply to Cynthia_sas

Thanks.

 

Hi,

 

I am using Mainframe BASE SAS, I can see the COPY LIB.

 

I am using INFILE and input statement to read the data.

 

I am using code like below

 

  data distribc;
     length  $11;
     keep ziprange
           check_amount
            balrange;
     retain ssa1 'CUSTOMER*D '
              ssa2 'CHCKACCT ';
     infile acctsam dli ssa=(ssa1,ssa2) status=st 
            pcbno=3;

Here the CHCKACCT segment contain 2 occurances from position 160 to 320,  i need to read amount field from position 163 to 170, first occurances i need to read as AMT1 and second occurance i need to read as AMT2 , 

 

I could not find any example from here

http://support.sas.com/documentation/cdl/en/acims/62983/HTML/default/viewer.htm#n10w0tj80b27mfn17odm...

 

probably i get tech support.

 

Thanks.

 

Occasional Contributor
Posts: 5

Re: fetch mainframe IMS data

Thanks.

Respected Advisor
Posts: 4,173

Re: fetch mainframe IMS data

Posted in reply to murali_vijayend

Hi,

 

In case you're dealing with a flat file then such a hierarchical structure could also be read without the SAS/Access Interface to IMS.

 

Do you by any chance have a Cobol Copybook for reading the structure? Are you using DI Studio?

 

Do you want to read all the data into a single de-normalized SAS table or do you want to extract the data into multiple tables?

 

If you're dealing with a flat file: Can you please post some sample data with re-occurences. This would really help to provide you some working sample code.

 

The approach is basically: Have multiple input statement using the @ modifier so you can first determine what kind of record you're dealing with and then branch to the input statement you need for this record.

 

 

 

Occasional Contributor
Posts: 5

Re: fetch mainframe IMS data

Hi,

 

I am using Mainframe BASE SAS, I can see the COPY LIB.

 

I am using INFILE and input statement to read the data.

 

I am using example code like below

 

  data distribc;
     length  $11;
     keep ziprange
           check_amount
            balrange;
     retain ssa1 'CUSTOMER*D '
              ssa2 'CHCKACCT ';
     infile acctsam dli ssa=(ssa1,ssa2) status=st 
            pcbno=3;

Here the CHCKACCT segment contain 2 occurances from position 160 to 320,  i need to read amount field from position 163 to 169, first occurances i need to read as AMT1 and second occurance i need to read as AMT2 , 

 

I could not find any example from here

http://support.sas.com/documentation/cdl/en/acims/62983/HTML/default/viewer.htm#n10w0tj80b27mfn17odm...

 

Please let  me know if you any doubt.

 

Thanks.

Respected Advisor
Posts: 4,173

Re: fetch mainframe IMS data

Posted in reply to murali_vijayend

OK, so it's not a flat file but you're actually directly interfacing with IMS using SAS/Access.

 

I believe Example 1: A Get Call could give you some guidance.

http://support.sas.com/documentation/cdl/en/acims/62983/HTML/default/viewer.htm#p1q7ur2j0pcgc0n1ebn6...

 

Sorry, can't be of more help in this situation but just advise you go with what @Cynthia_sas recommended in case you get stuck.

 

Trusted Advisor
Posts: 1,554

Re: fetch mainframe IMS data

In case of flat file you may develop a code like in attached document.

Ask a Question
Discussion stats
  • 10 replies
  • 596 views
  • 0 likes
  • 5 in conversation