Oconv(SrchRslts,"G":DelCnt-1:"/1")

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
ranga1970
Participant
Posts: 141
Joined: Thu Nov 04, 2004 3:29 pm
Location: Hyderabad

Oconv(SrchRslts,"G":DelCnt-1:"/1")

Post by ranga1970 »

Folk;
I am doing the production support and going through one of the routines returned some one

Part of it is

Code: Select all

CMD = "ls -a ":TmpFilePath:TmpFilePrefix:"*":TmpMarkerFileExtension
Call DSExecute ('UNIX',CMD, SrchRslts,ErrorCD)
         SrchRslts = Oconv(SrchRslts,"G":DelCnt-1:"/1")

I am familier with what DSExecute

it returns the value to SrchRslts

after this

Code: Select all

SrchRslts = Oconv(SrchRslts,"G":DelCnt-1:"/1")
what does this exactly do

what does DelCnt-1 mean

and in

Code: Select all

CMD = "ls -a ":TmpFilePath:TmpFilePrefix:"*":TmpMarkerFileExtension
I know what ls -a do

but no clue why it is included in quotes, does this have any additional meaning, if I go to unix prompt and give the command

"ls -a ":somepath/somefile.someextension

it says it did not find the ksh

looking for soem help from DS Guru.. to understand this..
I appreciate the help ...
RRCHINTALA
ds_developer
Premium Member
Premium Member
Posts: 224
Joined: Tue Sep 24, 2002 7:32 am
Location: Denver, CO USA

Post by ds_developer »

Here is what the G conversion code does (found in Basic.pdf):
G code: Group Extraction
Correlative and Conversion Codes C-21
Format
G [ skip ] delim #fields
The G code extracts one or more values, separated by the specified delimiter, from a field.

skip specifies the number of fields to skip; if it is not specified, 0 is assumed and no fields are skipped.

delim is any single nonnumeric character (except IM, FM, VM, SM, and TM) used as the field separator.

#fields is the decimal number of contiguous delimited values to extract.
It looks to me that it is skipping DelCnt-1 fields.
The delimiter is "/" and it is extracting 1 field.

The quotes in "ls -a " just makes it a string so it can be concatenated with the path, file prefix, "*" and extension (they would not be typed in on the command line).

Hope this helps,
John

(am I a guru now? I doubt it...)
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

DelCnt is a variable set earlier in your code.
The Oconv is specifying that the first (DelCnt - 1) "/" characters should be skipped then one pipe-delimited field returned.
An equivalent expression is:

Code: Select all

Field(SrchRslts, "/", DelCnt, 1)
Looks like the original developer grew up with Pick BASIC. Nothing wrong with that - it's just another way of doing things.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply