Page 1 of 1
BASIC query
Posted: Mon Jan 23, 2012 11:00 pm
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.
Posted: Mon Jan 23, 2012 11:48 pm
by chandra.shekhar@tcs.com
Set First Line is Column Name to False.
The header record will get automatically rejected.
Posted: Tue Jan 24, 2012 12:02 am
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.
Posted: Tue Jan 24, 2012 1:29 am
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 ?
Posted: Tue Jan 24, 2012 1:50 am
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
and read remaining using
in filter option in sequential file stage.
Posted: Tue Jan 24, 2012 1:51 am
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 ?
Posted: Tue Jan 24, 2012 2:25 am
by ray.wurlod
Neither. This is a question about the programming language, not about job design.
Posted: Tue Jan 24, 2012 2:27 am
by chandra.shekhar@tcs.com
My bad, I thought mdbatra does not want any header rows.
Posted: Tue Jan 24, 2012 2:30 am
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?
Posted: Tue Jan 24, 2012 7:29 am
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 !
Posted: Tue Jan 24, 2012 7:40 am
by mdbatra
on a lighter note - ..as you said..., not "u" :D