Data formating in Easytrieve

Ask/Clarify the questions on EASYTRIEVE

Moderators: DikDude, Moderator Group

Post Reply
vanithaaraju
Member
Posts: 12
Joined: Tue Dec 11, 2007 4:51 pm

Data formating in Easytrieve

Post by vanithaaraju » Tue Feb 24, 2009 4:30 pm

Hi,
My Input file's records look like this....
2007,ABINGDON EXTRA ,,,,Compass,,,,,,,,,,,,,,,,,,,,,,,,,,,,2005/34,
2008,ABINGDON EXTRA ,,,,Compass,,,,,,,,,,,,,,,,,,,,,,,,,,,,2005/30,
2017,ADDLESTONE ,,,,Avenance,,,,,,,,,,,,,,,,,,,,,,,,,,,,2006/26,
2019,ALTRINCHAM EXTRA ,,,,Compass,,,,,,,,,,,,,,,,,,,,,,,,,,,,2005/30,
2020,AMERSHAM ,,,,Avenance,,,,,,,,,,,,,,,,,,,,,,,,,,,,2005/30,
2021,AMMANFORD ,,,,tbc,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
2022,ALLERTON ROAD ,,,,tbc,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
2025,ALDERSHOT ,,,,Avenance,,,,,,,,,,,,,,,,,,,,,,,,,,,,2005/34,

I want to retrieve data that is at the end of each record (eg. 2005/34)
but this is not in the same coloum in all the records(,,,2005/30)..... how do i retrieve.??


Note: the input file does not have a copy layout.
It is just Input-File OCCURS 2000 times
VARIABLE-NAME PIC(X)
This makes it more confusing.

Is there some other way other than easytrieve??

Pls help........

User avatar
Natarajan
Moderator
Posts: 537
Joined: Fri Oct 10, 2008 12:57 pm
Location: chennai
Contact:

Post by Natarajan » Tue Feb 24, 2009 4:43 pm

You can do this in COBOL using INSPECT verb or using other string handling verbs.
Natarajan
Chennai

Veera
Moderator
Posts: 111
Joined: Wed Feb 22, 2006 2:59 pm

Post by Veera » Fri Mar 06, 2009 2:48 am

There are few questions I want to ask you before I provider any solution. But I will try to give some pointers by using which you might achieve want you want to.

It is just Input-File OCCURS 2000 times
VARIABLE-NAME PIC(X)

2007,ABINGDON EXTRA ,,,,Compass,,,,,,,,,,,,,,,,,,,,,,,,,,,,2005/34,
2008,ABINGDON EXTRA ,,,,Compass,,,,,,,,,,,,,2005/30,

If I understand the question right.

Irrespective of the length of the record, you want to extract the last ?7? bytes of data from each record.

From the definition of the file you have mentioned. I assume we can reference each byte of the file using an INDEX VARIABLE-NAME (INDEX) which is nothing but

VARIABLE-NAME (1)
VARIABLE-NAME (2)
??????????????.
VARIABLE-NAME (2000)

If the file layout had num-of-occurrences of each byte, which is nothing but the length of the file it would have been very straight forward.

There is something called as RECORD-LENGTH in EZT using which we can get the length of each record.

Syntax: OUTFILEB: RECORD-LENGTH
OUTFILEB (DD name of the input file)

Assign the length of each record to a working storage variable.

Now, if we have lengths of each record say 1700 for rec1 and 1600 rec2.


Start extracting data rec1, from 1694 (I assume that you need to extract last 7 bytes)

Start extracting data rec2, from 1594 (I assume that you need to extract last 7 bytes)

VARIABLE-NAME (1594)
VARIABLE-NAME (1595)
.....so on

You should able to extract what you need.

OTHER OPTION

If the assignments of the length of the record do not work then you need to load the data into some internal table until you hit the end of the record and get the length of each record and the rest of the process is same as mentioned above.

Hope this helps.

If both the ways do not work, post your question in DFSORT. Make sure you provide full details like FILE LRECL, FORMAT, input snap shot of data and the expected results with detailed examples, Frank will be able to help you if there is a way in DFSORT to do this.

Thanks,
Veera.

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others