Page 1 of 2

How to skip the trailer record

Posted: Wed Oct 19, 2005 3:28 am
by kumar_s
Hi,
How to skip the trailer record which has a different layout from the detail record. File is in ebcidic format. How can we do this with out any warning.

Regards
kumar

Posted: Wed Oct 19, 2005 3:55 am
by cmmurari
Hi Kumar,


Can you give us more information. what stage's you are using what the flow..

Cheers,
Krish

Posted: Wed Oct 19, 2005 7:05 am
by kumar_s
Hi,
I use CFF stage to read ebcidic file. Is there any other stage available to do this???
Flow is simple as reading a file and processing and writing to an Ascii file.
I can skip header, but need to find a way to skip trailer :?

regards
kumar

Posted: Wed Oct 19, 2005 12:11 pm
by clshore
You are already using CFF, so what did you use for file metadata?
EBCDIC files with headers/trailers typically are defined in terms of a COBOL file structure, where the header and trailer are REDEFINES of the base record structure.
I believe that the CFF will handle such correctly, as long as the schema matches the file.
Did you use a schema, or enter the metadata by hand?

Carter

Posted: Wed Oct 19, 2005 12:54 pm
by dsrules
Kumar,
Why not handle this by a before job subroutine which executes Unix cmds which strip the Header and Trailer in a shell script. Then have the CFF metadata for the Data records

HTH

dsrules

Posted: Wed Oct 19, 2005 8:45 pm
by kumar_s
Hi Carter,
The layout structure for trailier and detail is quite different. The record length also varies.
So basically i cant use trailer or header layout in the usage of detial records. Hene if detial layout reaches the trailer record it throws warning.

Hi dsrules,
Since this is an ebcidic file, we cant preprocess in unix.

regards
kumar

Posted: Wed Oct 19, 2005 9:14 pm
by chulett
The fact that it is an EBCDIC file doesn't stop you from 'preprocessing' the file in UNIX... the 'head' or 'tail' command could care less if it's EBCDIC, ASCII or Sanskrit. Go for it.

Posted: Thu Oct 20, 2005 7:07 am
by kumar_s
chulett wrote:The fact that it is an EBCDIC file doesn't stop you from 'preprocessing' the file in UNIX... the 'head' or 'tail' command could care less if it's EBCDIC, ASCII or Sanskrit. Go for it.
Hi Caraig,
Pls let me know the way to skip the trailer.
My point in ebcidic format is - if its in ascii i can manage to read the header and use head command till n-1. But iam not sure wheater i can use 'wc' for this purpose and will it procduce same output for ascii and ebcidic :roll:. (If iam not wrong, if its an fixed length record, i was under the impression that single line in ebcidic file may hold more than one ascii records.)

regards
kumar

Posted: Thu Oct 20, 2005 7:18 am
by chulett
kumar_s wrote:My point in ebcidic format is - if its in ascii i can manage to read the header and use head command till n-1. But iam not sure wheater i can use 'wc' for this purpose and will it procduce same output for ascii and ebcidic
Yes, you can use 'wc'. EBCDIC (only one 'eye') isn't magic or something that totally changes How Everything Works, it is just another character set and doesn't - in and of itself - change what a 'record' is or how they are read and/or handled.

Now, if you are working with a fixed-width file with no record terminators (like something in the past that would have come off a mag tape or some such) then you'll have issues regardless at the O/S level, but for now... why not just try it and see what happens?

Posted: Thu Oct 20, 2005 11:12 am
by clshore
Hmm..., that's exactly the point.
You said that you were using the CFF stage, right?
Have you read the functional description of what a CFF does?
In COBOL, the REDEFINES clause allows different layout structures for records contained in the same file.
See if you can obtain the COBOL FD for the file that you are attempting to read. Import it into Table Definitions. Then use it with your CFF.

Carter
kumar_s wrote:Hi Carter,
The layout structure for trailier and detail is quite different. The record length also varies.
So basically i cant use trailer or header layout in the usage of detial records. Hene if detial layout reaches the trailer record it throws warning.

Hi dsrules,
Since this is an ebcidic file, we cant preprocess in unix.

regards
kumar

Posted: Fri Oct 21, 2005 3:56 am
by kumar_s
HI Craig,

Correct me if iam wrong.
When i use the following command

Code: Select all

wc -l <filename>
it take some time and gives me 0 as result.

when i use

Code: Select all

ls -lart <filename>
It gives me 175500000 as result

Hence i was in impression that wc command in unix cannot find the record delimiter in ebcidic file and hence it cant be useful.

But let me know if iam making some mess somewehre.

If you need, i can give the screen prints of the above.
regards
kumar

Posted: Fri Oct 21, 2005 7:00 am
by chulett
No, that's fine. If you have no record terminators then you won't be able to use things like 'head' or 'tail' to trim out headers or trailers and will need to let the CFF stage do it for you. Carter has been trying to drive that point home.

All I was trying to point out is that EBCDIC and record/line terminators are not mutually exclusive. So your statement is more properly reworded to say: "Hence i was in impression that wc command in unix cannot find the record delimiter in this particular EBCDIC file and hence it can't be useful." True. In this case. :wink:

Posted: Fri Oct 21, 2005 8:33 am
by kumar_s
No, I dont have any redefines to perform condition check for trailer.
If i use the normal trailer layout along with the detial layout, the record get matched both to detial and trailer. So record get shuffled.


Is there any other way to suppress this warning/skip the trailer record???

regards
kumar

Posted: Fri Oct 21, 2005 11:15 am
by crouse
One other attempt...

USUALLY, if a mainfram file has different record types (Header, Detail, Trailer) there is a common column, USUALLY the first or second one, that says what type of record it is. (but you mentioned there are no REDEFINES in the copybook, which is really odd. Are you SURE you have the complete copybook member for defining your input file?)

Do you see such a column?

If so, the "Selection Criteria" tab on the CFF stage, at least on Server, lets you test for a value in a column and pass only those rows down the link.

Any such luck?

Posted: Mon Oct 24, 2005 11:20 pm
by kumar_s
Hi

Iam not good in Cobol. I have trailer and header layout but not conditional check it. The first letter for header is 'H' and trailor is 'T'. Is there any way i get to know hot to chaange the layout to check the first letter and fit into the given layout.
Or is there a any way to do it directly in CFF stage.

regards
kumar