IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Copy from First record to Rest


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Prajesh_v_p

Active User


Joined: 24 May 2006
Posts: 133
Location: India

PostPosted: Fri Dec 11, 2009 4:02 am
Reply with quote

Hi All,

I have a scenario where I have in input order num,Order time,Item id and B(buy)/D(Donot Buy) Indicator. But I need to take only the latest indicator based ontime for each order num.

Input:
--Ord num--|-----Ord time---------|--Item id--|--Ind--
0702272089 10/26/2009 13:10:36 456664554 B
0702272089 10/26/2009 12:10:36 456664552 D
0702272089 10/26/2009 11:10:36 456664652 B
0702272090 10/26/2009 13:10:36 456664552 D

Output:
--Ord num--|-----Ord time---------|--Item id--|--Ind--
0702272089 10/26/2009 13:10:36 456664554 B
0702272089 10/26/2009 12:10:36 456664552 B
0702272089 10/26/2009 11:10:36 456664652 B
0702272090 10/26/2009 13:10:36 456664552 D

Second record should get changed to B.

Thanks in advance.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Dec 11, 2009 4:12 am
Reply with quote

Code:

0702272089 10/26/2009 12:10:36 456664552 D
0702272089 10/26/2009 11:10:36 456664652 B


the D(on't buy) came after the to B(uy).

why would you want to change the latest to the earliest?
does not make any business sense to me.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Dec 11, 2009 4:21 am
Reply with quote

Prajesh,

In the only example of records with multiple order numbers, you show them as already sorted descending by date and time so the indicator you want would be in the first record with that key. Is that always the case or can the indicator you want NOT be in the first record with a key. For example, could you have:

1702272089 10/26/2009 12:10:36 456664552 D
1702272089 10/26/2009 11:10:36 456664652 B
1702272089 10/26/2009 13:10:36 456664554 B

so the last record is the one you want the indicator from? If you can have a set of records like this, what would you expect for the output records?

Also, what is the RECFM and LRECL of the input file, and what is the starting position, length and format of each input field?
Back to top
View user's profile Send private message
Prajesh_v_p

Active User


Joined: 24 May 2006
Posts: 133
Location: India

PostPosted: Fri Dec 11, 2009 4:37 am
Reply with quote

dbzTHEdinosauer,

I want to take only the latest information keyed in for an ordernum. hence I am taking the decision in the latest record.

Frank,

I Need to do a sort on the order num Asc and order time desc, which will make sure that I ll get the latest business decsion on top. It wud be great if I can combine this sort also into the solution. In, simple, I need the latest Decsion( B or D) for an ordernnum, nomatter how many items are there under that ordernum! and this needs to be propagated to all items under that ordernum.

hope this clarifies!
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Dec 11, 2009 4:52 am
Reply with quote

It would have helped if you'd answered all of my questions so I wouldn't have to make assumptions, but I suspect a DFSORT job like the following will do what you asked for:

Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/80)
//SORTOUT DD DSN=...  output file (FB/80)
//SYSIN    DD    *
  SORT FORMAT=CH,FIELDS=(1,10,A,18,4,D,12,5,D,23,8,D)
  OUTREC IFOUTLEN=80,
    IFTHEN=(WHEN=INIT,
      OVERLAY=(81:SEQNUM,8,ZD,RESTART=(1,10))),
    IFTHEN=(WHEN=GROUP,BEGIN=(81,8,ZD,EQ,1),PUSH=(42:42,1))
/*
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Dec 11, 2009 5:36 am
Reply with quote

my apologies. had assumed Item-ID was to be considered.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts VB to VB copy - Full length reached SYNCSORT 8
Search our Forums:

Back to Top