How to skip the trailer record

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

How to skip the trailer record

Post 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
cmmurari
Participant
Posts: 34
Joined: Sun Jan 02, 2005 9:55 am
Location: Singapore

Post by cmmurari »

Hi Kumar,


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

Cheers,
Krish
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post 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
clshore
Charter Member
Charter Member
Posts: 115
Joined: Tue Oct 21, 2003 11:45 am

Post 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
dsrules
Premium Member
Premium Member
Posts: 76
Joined: Sun Nov 28, 2004 8:56 pm

Post 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
______________________________________
"Everytime I close the door on reality, it comes in through the windows." - Jennifer Yane
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post 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
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post 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
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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?
-craig

"You can never have too many knives" -- Logan Nine Fingers
clshore
Charter Member
Charter Member
Posts: 115
Joined: Tue Oct 21, 2003 11:45 am

Post 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
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post 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
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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:
-craig

"You can never have too many knives" -- Logan Nine Fingers
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post 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
crouse
Charter Member
Charter Member
Posts: 204
Joined: Sun Oct 05, 2003 12:59 pm
Contact:

Post 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?
Craig Rouse
Griffin Resouces, Inc
www.griffinresources.com
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post 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
Post Reply