Unkown result in the output of a routine which use SETFILE

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

rajiivnb
Participant
Posts: 77
Joined: Fri Sep 10, 2004 8:38 am
Location: India

Unkown result in the output of a routine which use SETFILE

Post by rajiivnb »

Hi,

We wrote a routine with the below, where to find the total number of records. (20 records)

Cmd = 'SETFILE ' : hshdflpth : ' ' : 'hsdfile' :' OVERWRITING '
PERFORM Cmd
PERFORM 'COUNT ' : 'hsdfile'
Ans = @SYSTEM.RETURN.CODE


If i run the routine with a hashed file path and name given, the output is as below,

Arg1 = d:/ds/sam1/sample
Test Failed.
Pointer "hsdfile" established in VOC file.
20 records counted.
Result = 20


The output is shown exactly the number as 20 records. But why its shows TEST FAILED ? The same routine runs fine in one environment and shows the TEST FAILED in another environment.
Need you suggestions on the same.
Thanks in advance.
Last edited by rajiivnb on Thu Jan 25, 2007 7:52 am, edited 1 time in total.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

No idea, really. What's different between the two environments?
-craig

"You can never have too many knives" -- Logan Nine Fingers
rajiivnb
Participant
Posts: 77
Joined: Fri Sep 10, 2004 8:38 am
Location: India

Post by rajiivnb »

One is in Windows and another in UNIX. The problem is with UNIX server.
Can you please tell me, in what situation it gives TEST FAILED and TEST COMPLETED ?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

If I knew for sure I would have told you. At this point just fishing for more information so more smarter people (hopefully) find it easier to help you.
-craig

"You can never have too many knives" -- Logan Nine Fingers
rajiivnb
Participant
Posts: 77
Joined: Fri Sep 10, 2004 8:38 am
Location: India

Post by rajiivnb »

Thanks for your time, Chulett
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

I think that your routine contains more than you've shown, since the output line "Arg1 = d:/ds/sam1/sample" isn't part of the normal code, either. Could you change your code portion to read

Code: Select all

PRINT 'Before'
PERFORM Cmd 
PRINT 'After'
to prove that the "Not Found." text is being output by the PERFORM command?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The "test fails" for a very obscure reason, which you can ignore.

Warning - Technical Content
The test bed uses a system variable called @SYSTEM.RETURN.CODE to indicate success or failure. 0 is success.
Query verbs (like COUNT) also use @SYSTEM.RETURN.CODE to transmit the number of records processed.
Therefore, after your COUNT, @SYSTEM.RETURN.CODE is 20, which the test bed interprets as a failure.
</Technical Content>
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Very useful information Ray. Very useful. I was breaking my head trying to get to the bottom of this.
I still dont get one thing, how come it works in one environment for the OP and not in another :roll: ?
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

That's a mystery. I could only ask "what's different between the two environments?" before attempting to essay an answer.

My guess would be that "d:/ds/sam1/sample" exists in one environment and not in the other, and that they've changed how the test bed detects failure (so that my previous post is no longer correct).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Or possible the hashed file in one environment is empty.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Possible. In that case @SYSTEM.RETURN.CODE would return 0.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

And I was correct in my hunch. I ran a CLEAR.FILE before running the Cmd in the OP's routine. It returned zero with "Test Completed" message. :D
They did'nt change the test bed, atleast we know that for sure.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Rajiivnb, use this routine instead and see what results you get. It works at my end

Code: Select all

Cmd = 'SETFILE ' : hshdflpth : ' ' : 'hsdfile' :' OVERWRITING ' 
PERFORM Cmd 
PERFORM 'COUNT ' : 'hsdfile' 
Ans = @SYSTEM.RETURN.CODE 
@SYSTEM.RETURN.CODE = 0
All i did was to add "@SYSTEM.RETURN.CODE = 0" at the end to tell the underlying engine that everything is ok.

Ray, is that a safe thing to do?
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Not really. What if there really had been a failure? The following would be preferable. Not only because it's documented (hint!).

Code: Select all

      * Construct and execute SETFILE command.
      Cmd = 'SETFILE ' : hshdflpth : ' ' : 'hsdfile' :' OVERWRITING ' 
      PERFORM Cmd 

      * Record result of SETFILE command.
      Temp = @SYSTEM.RETURN.CODE

      If Temp = 0
      Then
         * Determine number of records in hashed file for return by function.
         PERFORM 'COUNT ' : 'hsdfile' 
         Ans = @SYSTEM.RETURN.CODE 
      End
      Else
         Ans = @NULL  ; * SETFILE failed
      End

      * Report status of SETFILE command to test bed.
      @SYSTEM.RETURN.CODE = Temp
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Sweet.....Makes sense. Thanks Ray. :)
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Post Reply