Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 6968
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: 6968
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 Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
No new posts XMITIP sends it out. Can it copy on l... Rommel Dayon Rustia IBM Tools 0 Tue Sep 05, 2017 10:16 am
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts Repeat part of record multiple times Learncoholic DFSORT/ICETOOL 4 Tue Aug 29, 2017 11:33 am
No new posts Unable to copy data from spool in a d... srikant314 JCL & VSAM 8 Fri Jul 28, 2017 9:10 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us