BASIC query

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
mdbatra
Premium Member
Premium Member
Posts: 175
Joined: Wed Oct 22, 2008 10:01 am
Location: City of London

BASIC query

Post by mdbatra »

Hi,
i am reading a sequential file in a job control(pipe delimited), having just 2 records. First record is header ( ValidFrom | ValidTo) & second is having some data values (like, 10 | 15).
I need to directly read the data record(10 | 15) and separate the field values and use them for further logic.
for now, i have just read the file in loop and after exiting from loop it gives me the desired result. but i feel there could be a way to directly read a particular record from seq file. i checked BASIC guide, but couldn't find any.
Any help on this would be appreciated.
Rgds,
MB
chandra.shekhar@tcs.com
Premium Member
Premium Member
Posts: 353
Joined: Mon Jan 17, 2011 5:03 am
Location: Mumbai, India

Post by chandra.shekhar@tcs.com »

Set First Line is Column Name to False.
The header record will get automatically rejected.
Thanx and Regards,
ETL User
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

"Sequential" means just that - you must read past every byte in the file to get to the next. Your simplest solution is two ReadSeq statements - discard the results of the first and process the results of the second.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
mdbatra
Premium Member
Premium Member
Posts: 175
Joined: Wed Oct 22, 2008 10:01 am
Location: City of London

Post by mdbatra »

Chandra- we need to have a header as well, as per the requirements.
Ray - i got your point. But isn't that same as issuing READSEQ in loop ?
Rgds,
MB
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post by pandeesh »

if you are insisting to use jobcontrol code , then READSEQ is the way you need to follow;
If you are ok with a job, then read header separately using

Code: Select all

head -1
and read remaining using

Code: Select all

sed -e '1d'
in filter option in sequential file stage.
pandeeswaran
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post by pandeesh »

chandra.shekhar@tcs.com wrote:Set First Line is Column Name to False.
The header record will get automatically rejected.
True or False :) ?
pandeeswaran
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Neither. This is a question about the programming language, not about job design.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chandra.shekhar@tcs.com
Premium Member
Premium Member
Posts: 353
Joined: Mon Jan 17, 2011 5:03 am
Location: Mumbai, India

Post by chandra.shekhar@tcs.com »

My bad, I thought mdbatra does not want any header rows. :oops:
Thanx and Regards,
ETL User
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

It's the same as using a loop, but why code the loop when you know that there are only two lines in the file?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
mdbatra
Premium Member
Premium Member
Posts: 175
Joined: Wed Oct 22, 2008 10:01 am
Location: City of London

Post by mdbatra »

Ray- yeah correct...plus i find that the processing which i needed, would be executed only once if i use 2 READSEQs, but in loop 2 times. Not much difference, but yes as u said, still better to reduce any processing if we can.
Thanks !
Rgds,
MB
mdbatra
Premium Member
Premium Member
Posts: 175
Joined: Wed Oct 22, 2008 10:01 am
Location: City of London

Post by mdbatra »

on a lighter note - ..as you said..., not "u" :D
Rgds,
MB
Post Reply