How to define two record layout for a single input file



Unicenter CA-Easytrieve Plus Report Generator: CA's information retrieval and data management tool

How to define two record layout for a single input file

Postby Abhay2012 » Mon Apr 09, 2012 10:08 am

Hi,

Can anyone please suggest how to define two record fields layout for a single input file.
I have a input file but have to read file from two different layouts, so if I read the file both the record fields layout should be populated.
e.g

FILE PERSNL VS
%PERSNL1
%PERSNL2

If have input file,PERSNL and having two layout PERSNL1 and PERSNL2(having same record format and record length). And if read file PERSNL both the filelds layout should populated.

Thanks!
Abhay2012
 
Posts: 2
Joined: Sun Apr 08, 2012 6:52 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to define two record layout for a single input file

Postby BillyBoyo » Mon Apr 09, 2012 1:57 pm

Abhay2012 wrote:Hi,

Can anyone please suggest how to define two record fields layout for a single input file.
I have a input file but have to read file from two different layouts, so if I read the file both the record fields layout should be populated.
e.g

FILE PERSNL VS
%PERSNL1
%PERSNL2

If have input file,PERSNL and having two layout PERSNL1 and PERSNL2(having same record format and record length). And if read file PERSNL both the filelds layout should populated.

Thanks!


That would be a way to define two record layouts for the same file.

However, I have no idea what you mean when you say "have to read file from two different layouts" or "if I read the file both the record fields layout should be populated".

You (or Easytrieve Plus) read the file. What the record-layouts do is "map" the data that is on the file. If you have two record-layouts, you have two "maps" (presumably you can identify which record is the current one from the data, so you know which "map" to use). Nothing gets "populated" into the layouts. You'll only have data on the file, and two different maps of that data (obviously, both maps are of the same storage location).

If you are trying to achieve something else, you'll have to describe as best you can what that is.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: How to define two record layout for a single input file

Postby Abhay2012 » Mon Apr 09, 2012 3:05 pm

Thanks Billy for quick response!

Let me try to explain what I'm trying to achieve..

Say, I have a input file PERSNL. And I have to check some condition for two fields GR-STS-CD and DV-STS-CD
i.e

IF GR-STS-CD = A
IF DV-STS-CD = A
........
.........
END-IF
END-IF

But one field GR-STS-CD is present in record layout PERSNL1 and other is in PERSNL2 (field positions are different in file PERSNL for these two fields. GR-STS-CD starts from 727 position for layout PERSNL1 and DV-STS-CD starts from 633 position for layout PERSNL2)

So my question is if I define file as below:

FILE PERSNL VS
%PERSNL1
%PERSNL2

will the data be mapped for both record layout ?

Regards
-Ravi
Abhay2012
 
Posts: 2
Joined: Sun Apr 08, 2012 6:52 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to define two record layout for a single input file

Postby BillyBoyo » Mon Apr 09, 2012 3:27 pm

Yes, the data will be mapped for both record-layouts.

You do have a potential problem. If you ignore identifying which record is which, you may do the test on the second record-type whilst having the data for the first record-type on the file, and get a false "hit" when the data happens to coincide with whatever is on the record at that position.

You must identify first which record-type the current record on the file is, and then you'll know which layout to use for the current record, and have a different logic "leg" for the other record-type.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times


Return to CA-Easytrieve

 


  • Related topics
    Replies
    Views
    Last post