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...
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
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
Thanks.
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.
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
probably i get tech support.
Thanks.
Thanks.
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.
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
Please let me know if you any doubt.
Thanks.
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.
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.
In case of flat file you may develop a code like in attached document.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.