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
 
Getting the records with the lastest date

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Alexis Sebastian

New User


Joined: 04 Mar 2010
Posts: 38
Location: DC

PostPosted: Wed Dec 22, 2010 8:39 pm    Post subject: Getting the records with the lastest date
Reply with quote

There is an input file in the below format,
Code:

H21122010HEADER RECORD
D00000000019122010   
D00000000020122010   
D00000000021122010   
T0000003             


Input file Description:-
1. First Byte shows H - Header D- Detail T-Trailer records
2. In Header record, from position 2 to pos 9 -> header date
3. in Detail Record, from Pos 11 to pos 18 -> date field
4. In Trailer record, from pos 2 to pos 8 is the trailer count.
5. Date format is 'DDMMYYYY'

Output requirements:-
1. Need to copy the header record as it is
2. records with the latest date need to be taken out for detail records.
3. Also latest date in the detail record should match with the header date
4. Correspondingly trailer count needs to be written based on the no of detail records.

Sample Output file is given below.
Code:

H21122010HEADER RECORD
D00000000021122010   
T0000001             
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: Wed Dec 22, 2010 11:27 pm    Post subject:
Reply with quote

Your output requirements are not clear (actually they don't even make sense).

Quote:
2. records with the latest date need to be taken out for detail records.


But your output file example has the latest date. So what do you mean by "taken out". Looks like the other dates were taken out.

Quote:
3. Also latest date in the detail record should match with the header date


Huh? Are you trying to keep the detail record with the same date as the header? What do you want to do if the detail record does not match the header date. Your explanation is quite confusing.

You need to do a better job of explaining what you want to do with better examples of input and expected output.
Back to top
View user's profile Send private message
Alexis Sebastian

New User


Joined: 04 Mar 2010
Posts: 38
Location: DC

PostPosted: Thu Dec 23, 2010 7:51 pm    Post subject:
Reply with quote

Sorry Frank!!! Here it goes...

Need to keep the details records with the same date as the Haeader date.

If there is no match then, only Header and trailer record will be there in the output file. trailer count would be zero.
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: Thu Dec 23, 2010 11:19 pm    Post subject:
Reply with quote

You can use a DFSORT job like the following to do what you asked for. I assumed your input file has RECFM=FB and LRECL=80, but you can change the job appropriately for other attributes.

Code:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=...  input file (FB/80)
//SORTOUT DD DSN=...  output file (FB/80)
//SYSIN DD *
  OPTION COPY
  OMIT COND=(1,1,CH,EQ,C'T')
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,1,CH,EQ,C'H'),
    PUSH=(81:2,8))
  OUTFIL REMOVECC,
   INCLUDE=(1,1,CH,EQ,C'H',OR,
    (1,1,CH,EQ,C'D',AND,81,8,CH,EQ,11,8,CH)),
    BUILD=(1,80),
    TRAILER1=(C'T',COUNT-1=(M11,LENGTH=7))
/*
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 Validate the Date girishb2 DFSORT/ICETOOL 9 Tue Sep 19, 2017 1:12 am
No new posts Julian Date to CICS ABSTTIME blayek CICS 3 Wed Aug 30, 2017 11:15 pm
No new posts Join records from 2 files with No Dup... Poha Eater DFSORT/ICETOOL 21 Sun Aug 27, 2017 10:35 pm
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm

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