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
 

 

Group with previous and subsequent records
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
scorp_rahul23

New User


Joined: 06 May 2008
Posts: 90
Location: Chennai

PostPosted: Tue May 08, 2012 1:20 am    Post subject: Reply to: Modifying last record in file
Reply with quote

I have one more query.

I have my input file as

Code:

----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
***************************** Top of Data ******************************
            12122                                                       
000000000000FFFFF4444444444444444444444444444444444444444444444444444444
000000000000121230000000000000000000000000000000000000000000000000000000
      â  qo"  q ¤                                                       
FFFF00430997009394444444444444444444444444444444444444444444444444444444
FFFF0F2F086F0088F0000000000000000000000000000000000000000000000000000000
            12123                                                       
000000000000FFFFF4444444444444444444444444444444444444444444444444444444
000000000000121230000000000000000000000000000000000000000000000000000000
-----------------------------------------------------------------------
PAYM  O¶    ¾     `T715014         ð                1715014     S1894628
DCED00DB0001B002007EFFFFFF01014400080000000044444444FFFFFFF00101EFFFFFFF
71840166000F9C2202937150140A0A0000AC0000000000000000171501400A0A21894628
-----------------------------------------------------------------------
      â  qo"  q ¤                                                       
FFFF00430997009394444444444444444444444444444444444444444444444444444444
FFFF0F2F086F0088F0000000000000000000000000000000000000000000000000000000
            12125                                                       
000000000000FFFFF4444444444444444444444444444444444444444444444444444444
000000000000121230000000000000000000000000000000000000000000000000000000
      â  qo"  q ¤                                                       
FFFF00430997009394444444444444444444444444444444444444444444444444444444
FFFF0F2F086F0088F0000000000000000000000000000000000000000000000000000000


And I need to my output file as below.

Code:

            12123                                                       
000000000000FFFFF4444444444444444444444444444444444444444444444444444444
000000000000121230000000000000000000000000000000000000000000000000000000
-----------------------------------------------------------------------
PAYM  O¶    ¾     `T715014         ð                1715014     S1894628
DCED00DB0001B002007EFFFFFF01014400080000000044444444FFFFFFF00101EFFFFFFF
71840166000F9C2202937150140A0A0000AC0000000000000000171501400A0A21894628
-----------------------------------------------------------------------
      â  qo"  q ¤                                                       
FFFF00430997009394444444444444444444444444444444444444444444444444444444
FFFF0F2F086F0088F0000000000000000000000000000000000000000000000000000000


Logic behind this output file is I want the record which is above the PAYM recd and below the PAYM record.

In Input file it can have more than one PAYM record like



Code:

----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
***************************** Top of Data ******************************
            12122                                                       
000000000000FFFFF4444444444444444444444444444444444444444444444444444444
000000000000121230000000000000000000000000000000000000000000000000000000
      â  qo"  q ¤                                                       
FFFF00430997009394444444444444444444444444444444444444444444444444444444
FFFF0F2F086F0088F0000000000000000000000000000000000000000000000000000000
            12123                                                       
000000000000FFFFF4444444444444444444444444444444444444444444444444444444
000000000000121230000000000000000000000000000000000000000000000000000000
-----------------------------------------------------------------------
PAYM  O¶    ¾     `T715014         ð                1715014     S1894628
DCED00DB0001B002007EFFFFFF01014400080000000044444444FFFFFFF00101EFFFFFFF
71840166000F9C2202937150140A0A0000AC0000000000000000171501400A0A21894628
PAYM2  O¶    ¾     `T715014         ð                1715014     S1894628
DCED00DB0001B002007EFFFFFF01014400080000000044444444FFFFFFF00101EFFFFFFF
71840166000F9C2202937150140A0A0000AC0000000000000000171501400A0A21894628
-----------------------------------------------------------------------
      â  qo"  q ¤                                                       
FFFF00430997009394444444444444444444444444444444444444444444444444444444
FFFF0F2F086F0088F0000000000000000000000000000000000000000000000000000000
            12125                                                       
000000000000FFFFF4444444444444444444444444444444444444444444444444444444
000000000000121230000000000000000000000000000000000000000000000000000000
      â  qo"  q ¤                                                       
FFFF00430997009394444444444444444444444444444444444444444444444444444444
FFFF0F2F086F0088F0000000000000000000000000000000000000000000000000000000



Any suggestions whether this can be implemented in sort ..

thanks in advance
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: Tue May 08, 2012 1:57 am    Post subject:
Reply with quote

Quote:
In Input file it can have more than one PAYM record like


And what do you want for output in that case?

You need to explain more clearly what you want to do before we can help.

Please explain the "rules" you want to use for all possible situations (one PAYM record, two PAYM records, etc). Also, give the RECFM and LRECL of the input file and any other relevant information.
Back to top
View user's profile Send private message
scorp_rahul23

New User


Joined: 06 May 2008
Posts: 90
Location: Chennai

PostPosted: Tue May 08, 2012 8:07 am    Post subject: Reply to: Modifying last record in file
Reply with quote

In output file I want the record which is just above the first PAYM record , all PAYM records and Record which is just after last PAYM records.

RECFM=FB. LRECL=32500
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: Tue May 08, 2012 10:55 pm    Post subject:
Reply with quote

Clear as mud.

It's not clear if the PAYM records are always sequential (e.g. data records, 5 PAYM records, data records) or can be spread throughout the file (e.g. data records, PAYM record, data records, PAYM record, etc)?

Since you are having trouble describing what you want, you'll need to show examples (for any and all possible cases).
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue May 08, 2012 11:26 pm    Post subject:
Reply with quote

Hello,

With this data:

Data1
Data2
Data3
PAYM
Data4
PAYM
PAYM
Data5
PAYM
Data6
Data7
Data8

i believe the desired output is:
Data3
PAYM
Data4
PAYM
PAYM
Data5
PAYM
Data6
Back to top
View user's profile Send private message
scorp_rahul23

New User


Joined: 06 May 2008
Posts: 90
Location: Chennai

PostPosted: Wed May 09, 2012 12:01 am    Post subject: Reply to: Modifying last record in file
Reply with quote

Input file will be a little different it can be like this.

Data1
Data2
Data3
PAYM
Data4
Data5
Data6


Data1
PAYM
PAYM
Data2
Data3
Data4
Data5
Data6


Its like payment record will be together only and in a single bunch
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed May 09, 2012 12:14 am    Post subject:
Reply with quote

Hello,

In your example, what should be the output?

The Data(n's) appear to repeat. . . icon_confused.gif

Your rule says:
Quote:
I want the record which is just above the first PAYM record , all PAYM records and Record which is just after last PAYM records
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7226

PostPosted: Wed May 09, 2012 12:19 am    Post subject: Reply to: Modifying last record in file
Reply with quote

It looks like Batch Header (binary zeros), data, Batch Trailer (hex FFs).

Is there other data in some batches. so what you want is all the batches with PAYMs and which can only contain PAYMs, not be mixed with other data?
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed May 09, 2012 12:24 am    Post subject: Re: Reply to: Modifying last record in file
Reply with quote

scorp_rahul23 wrote:
Input file will be a little different it can be like this.

Data1
Data2
Data3
PAYM
Data4
Data5
Data6


Data1
PAYM
PAYM
Data2
Data3
Data4
Data5
Data6


Its like payment record will be together only and in a single bunch


and the expected output from this is ??????
Back to top
View user's profile Send private message
scorp_rahul23

New User


Joined: 06 May 2008
Posts: 90
Location: Chennai

PostPosted: Wed May 09, 2012 1:56 am    Post subject: Reply to: Modifying last record in file
Reply with quote

Quote:

Data1
Data2
Data3
PAYM
Data4
Data5
Data6


Data1
PAYM
PAYM
Data2
Data3
Data4
Data5
Data6


Its like payment record will be together only and in a single bunch


Output will be


Data3
PAYM
Data4



Data1
PAYM
PAYM
Data2
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed May 09, 2012 2:02 am    Post subject:
Reply with quote

Hello,

You still have not provided what is needed. . .

How does one know when one "group" ends and the next begins. . . icon_confused.gif

You need to post (in English sentences) the rules for the process to follow. . .
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 May 09, 2012 3:11 am    Post subject:
Reply with quote

I believe those are two separate sets of input records - right? It appears that the PAYM records will only appear at one point in the input file, but there could be more than one PAYM record at that point and they will be consecutive. So for the one, two, three, etc PAYM records, you want the record before the first PAYM record and the record after the last PAYM record.

Is that correct?
Back to top
View user's profile Send private message
scorp_rahul23

New User


Joined: 06 May 2008
Posts: 90
Location: Chennai

PostPosted: Wed May 09, 2012 9:01 am    Post subject: Reply to: Modifying last record in file
Reply with quote

Yes Frank you are right
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed May 09, 2012 9:37 pm    Post subject: Re: Reply to: Modifying last record in file
Reply with quote

scorp_rahul23 wrote:
Yes Frank you are right


How do you explain
Code:

Data1
Data2
Data3
PAYM
Data4
Data5
Data6
Data1
PAYM
PAYM
Data2
Data3
Data4
Data5
Data6



Output will be

Code:

Data3
PAYM
Data4  <<< how did this get in the output which is after PAYM?

Data1
PAYM
PAYM
Data2



Assuming that data4 record is a typo , the following DFSORT/ICETOOL JCL will give you the desired results.

Code:

//STEP0100 EXEC PGM=ICETOOL                                   
//TOOLMSG  DD SYSOUT=*                                       
//DFSMSG   DD SYSOUT=*                                       
//IN       DD *                                               
Data1                                                         
Data2                                                         
Data3                                                         
PAYM                                                         
Data4                                                         
Data5                                                         
Data6                                                         
Data1                                                         
PAYM                                                         
PAYM                                                         
Data2                                                         
Data3                                                         
Data4                                                         
Data5                                                         
Data6                                                         
//OUT      DD SYSOUT=*                                       
//TOOLIN   DD *                                               
  SELECT FROM(IN) TO(OUT) ON(32501,8,CH) ALLDUPS USING(CTL1) 
//CTL1CNTL DD *                                               
  SORT FIELDS=COPY                                           
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(32501:SEQNUM,8,ZD,X,       
                SEQNUM,8,ZD,RESTART=(1,4))),                 
  IFTHEN=(WHEN=(1,4,CH,EQ,C'PAYM',AND,32510,8,ZD,EQ,1),       
  OVERLAY=(32501:+1,SUB,32501,8,ZD,M11,LENGTH=8)),           
  IFTHEN=(WHEN=(1,4,CH,EQ,C'PAYM',AND,32510,8,ZD,EQ,2),       
  OVERLAY=(32501:+1,ADD,32501,8,ZD,M11,LENGTH=8))             
                                                             
  OUTFIL BUILD=(1,32500)                                     
//*


The output from the above is
Code:

Data3   
PAYM     
Data1   
PAYM     
PAYM     
Data2   
Back to top
View user's profile Send private message
scorp_rahul23

New User


Joined: 06 May 2008
Posts: 90
Location: Chennai

PostPosted: Sat May 12, 2012 2:11 am    Post subject: Reply to: Modifying last record in file
Reply with quote

Thanks a lot it worked . U are too good
Back to top
View user's profile Send private message
scorp_rahul23

New User


Joined: 06 May 2008
Posts: 90
Location: Chennai

PostPosted: Tue May 22, 2012 10:44 am    Post subject: Reply to: Modifying last record in file
Reply with quote

If my data is like

Data1
Data2
Data3
PAYM
Data4
Data5
Data6


I need output like

Data3
PAYM
Data4


But the code is not giving me desired output. Any sugeestions why its not working
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7226

PostPosted: Tue May 22, 2012 11:17 am    Post subject: Reply to: Modifying last record in file
Reply with quote

Suggest you post the sort cards, sysout and what is being produced.
Back to top
View user's profile Send private message
scorp_rahul23

New User


Joined: 06 May 2008
Posts: 90
Location: Chennai

PostPosted: Tue May 22, 2012 11:41 am    Post subject: Reply to: Modifying last record in file
Reply with quote

Code:

//STEP0100 EXEC PGM=ICETOOL                                   
//TOOLMSG  DD SYSOUT=*                                       
//DFSMSG   DD SYSOUT=*                                       
//IN       DD *                                               
Data1                                                         
Data2                                                         
Data3                                                         
PAYM                                                         
Data4                                                         
Data5                                                         
Data6                                                         
//OUT      DD SYSOUT=*                                       
//TOOLIN   DD *                                               
  SELECT FROM(IN) TO(OUT) ON(32501,8,CH) ALLDUPS USING(CTL1) 
//CTL1CNTL DD *                                               
  SORT FIELDS=COPY                                           
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(32501:SEQNUM,8,ZD,X,       
                SEQNUM,8,ZD,RESTART=(1,4))),                 
  IFTHEN=(WHEN=(1,4,CH,EQ,C'PAYM',AND,32510,8,ZD,EQ,1),       
  OVERLAY=(32501:+1,SUB,32501,8,ZD,M11,LENGTH=8)),           
  IFTHEN=(WHEN=(1,4,CH,EQ,C'PAYM',AND,32510,8,ZD,EQ,2),       
  OVERLAY=(32501:+1,ADD,32501,8,ZD,M11,LENGTH=8))             
                                                             
  OUTFIL BUILD=(1,32500)                                     
//*



Output was

Data3
PAYM
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7226

PostPosted: Tue May 22, 2012 11:59 am    Post subject: Re: Reply to: Modifying last record in file
Reply with quote

You missed commenting on what Kolusu said here.


Skolusu wrote:
scorp_rahul23 wrote:
Yes Frank you are right


How do you explain
Code:

Data1
Data2
Data3
PAYM
Data4
Data5
Data6
Data1
PAYM
PAYM
Data2
Data3
Data4
Data5
Data6



Output will be

Code:

Data3
PAYM
Data4  <<< how did this get in the output which is after PAYM?

Data1
PAYM
PAYM
Data2



Assuming that data4 record is a typo , the following DFSORT/ICETOOL JCL will give you the desired results.

[...]
Back to top
View user's profile Send private message
scorp_rahul23

New User


Joined: 06 May 2008
Posts: 90
Location: Chennai

PostPosted: Tue May 22, 2012 4:46 pm    Post subject: Reply to: Modifying last record in file
Reply with quote

I missed that out, but as per the my output file requirement its not a typo.
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
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts How to get previous month in SYMNAMES Suganya87 SYNCSORT 9 Fri Oct 28, 2016 1:37 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm


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