Using READBLK

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
nilotpalr
Participant
Posts: 29
Joined: Tue Dec 10, 2002 2:54 am

Using READBLK

Post by nilotpalr »

I need to use the READBLK routine of DataStage BASIC. My File size is of about 200 KB. What block size should I use to that I am abe to read the file at one shot. I am unable to read the file completely with block size 300000. Else what is the alternative to read the file of such size using READBLK.

Thanks in advance..
Nilotpal.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Without having all the manuals to hand (I'm on vacation) I believe there is an upper limit (32K? 64K?) that READBLK can handle.

To read the file in a single shot you can treat it as a record in a table. Open its directory with OPENPATH or OPEN, then read the record with READ, using the file name as the record key. For example, to read /etc/passwd in a single shot:

Equate RoutineName To "MyRoutine"
OpenPath "/etc" To filevariable
On Error
Message = 'Unable to open "/etc". Code ' : Status()
Call DSLogWarn(Message, RoutineName)
End
Then
Read PasswdFile From filevariable, "passwd"
On Error
Message = 'Cannot read "/etc/passwd". Code ' : Status()
Call DSLogWarn(Message, RoutineName)
End
Then
GoSub ProcessFile
End
Else
Message = '"/etc/passwd" not found. Eek!'
Call DSLogWarn(Message, RoutineName)
End ; * end of Read statement
End
Else
Message = 'Cannot open "/etc".'
Call DSLogWarn(Message, RoutineName)
End ; * end of OpenPath statement

The upper limit is now really only limited by how much string space can be allocated by DSEngine - it will be Megabytes.
Post Reply