Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Copy from First record to Rest

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Copy from First record to Rest
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    Post subject:
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 Moderator


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

PostPosted: Fri Dec 11, 2009 4:21 am    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Fri Dec 11, 2009 4:52 am    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts HALDB data refresh/copy from producti... vineetanand2007 IMS DB/DC 1 Mon Jan 02, 2017 11:16 am
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us