To Assign Seq No.s to Invoice

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

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

Post by ray.wurlod »

Sort by Inv and Rec Type. The rest follows easily, particularly if you have the Sort stage generate Key Change column.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
edward_m
Charter Member
Charter Member
Posts: 257
Joined: Fri Jun 24, 2005 9:34 am
Location: Philadelphia,PA

Post by edward_m »

ray.wurlod wrote:Sort by Inv and Rec Type. The rest follows easily, particularly if you have the Sort stage generate Key Change column.
Ray..
I can't sort ..because these are header and trailer records.There is one more data column attached to each and every record.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

So... you don't feel comfortable enough with the concept of stage variables to adapt the code for this 'new' requirement, so didn't try? Or you've tried and couldn't make it work?
-craig

"You can never have too many knives" -- Logan Nine Fingers
edward_m
Charter Member
Charter Member
Posts: 257
Joined: Fri Jun 24, 2005 9:34 am
Location: Philadelphia,PA

Post by edward_m »

Chulette,

I tried in different ways and i didn't get the correct output..
Any help on this would be appreciated
edward_m
Charter Member
Charter Member
Posts: 257
Joined: Fri Jun 24, 2005 9:34 am
Location: Philadelphia,PA

Post by edward_m »

chulett wrote:So... you don't feel comfortable enough with the concept of stage variables to adapt the code for this 'new' requirement, so didn't try? Or you've tried and couldn't make it work?
Chulette..
I am fully not understand stage variable..if i am not asking too much then could you please give me the code for this also.
Thanks in advance
shepli
Participant
Posts: 79
Joined: Fri Dec 17, 2004 9:56 am

Post by shepli »

Input: InvNo and RecType

Create 3 stage variables:
svNewInvNo (init val=""): If input.InvNo=svInvNo Then 0 Else 1
svInvNo (init val=""): input.InvNo
svSeqNo (init val=0): If svNewInvNo Then 1 Else (If input.RecType="605" Then svSeqNo+1 Else svSeqNo)

Output: InvNo = input.InvNo
RecType = input.RecType
SeqNo = svSeqNo

Hope this works for you.

shepli
edward_m
Charter Member
Charter Member
Posts: 257
Joined: Fri Jun 24, 2005 9:34 am
Location: Philadelphia,PA

Post by edward_m »

shepli wrote:Input: InvNo and RecType

Create 3 stage variables:
svNewInvNo (init val=""): If input.InvNo=svInvNo Then 0 Else 1
svInvNo (init val=""): input.InvNo
svSeqNo (init val=0): If svNewInvNo Then 1 Else (If input.RecType="605" Then svSeqNo+1 Else svSeqNo)

Output: InvNo = input.InvNo
RecType = input.RecType
SeqNo = svSeqNo

Hope this works for you.

shepli
Shepli..Thanks for your reply.
Could you please suggest me the code for my previous post..510 and 520 records
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

edward_m, there are several codes provided by our posters. Shepli gave you code for each scenario. See what works and if you are not getting the desired result, let us know what output you are getting for what code.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Post Reply