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
 

 

DFSORT Query

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

New User


Joined: 17 Jul 2007
Posts: 41
Location: pune

PostPosted: Thu Jul 05, 2012 11:51 am    Post subject: DFSORT Query
Reply with quote

Hi,

I have a input File with below format:

Code:
HDR1 XXXX SRINATHD YYYYYYYY AAAAA BBBBBB $NEWSELLL ---- 
01,111111111,1111111111,111111,1111,1,11,/               
02,2222222222,222222222,1,120704,2222,/                 
03,333,33333333,0,3333333333333,NONE,120615 SRINATH
04,4444444444455555555555                             
EOF1 XXXX SRINATHD YYYYYYYY AAAAA BBBBBB $NEWSELLL 00000 00000 0000000 6666666

HDR1 XXXX RAVINDER YYYYYYYY AAAAA BBBBBB $NEWSELLL ---- 
01,111111111,1111111111,111111,1111,1,11,/               
02,2222222222,222222222,1,120704,2222,/                 
03,333,33333333,0,3333333333333,NONE,120615 SRINATH
04,4444444444455555555555                             
EOF1 XXXX RAVINDER YYYYYYYY AAAAA BBBBBB $NEWSELLL 00000 00000 0000000 9999999

HDR1 XXXX HEMANTHA YYYYYYYY AAAAA BBBBBB $NEWSELLL ---- 
01,111111111,1111111111,111111,1111,1,11,/               
02,2222222222,222222222,1,120702,2222,/                 
03,333,33333333,0,3333333333333,NONE,120615 SRINATH
04,4444444444455555555555                             
EOF1 XXXX HEMANTHA YYYYYYYY AAAAA BBBBBB $NEWSELLL 00000 00000 0000000 22222222


If in 02 record level the date is equal to prior date i.e.( today's Date -1). Then write the EOF1 record with only Highlighted Field.

O/P Should be:

Code:
SRINATHD | 6666666
RAVINDER | 9999999

I have written the Sort Card But it's not working. Please suggest the Solution:

Code:
//SYSIN DD *
OPTION COPY

INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,2,CH,EQ,C'02',AND,27,6,CH,EQ,Y'DATE1'-1),
END=(1,4,CH,EQ,C'EOF1'),PUSH=(81:ID,2))
OUTFIL INCLUDE=(1,4,CH,EQ,C'EOF1',AND,81,2,CH,NE,C' '), 
BUILD=(11,8,9X,C' | ',72,8,52X)
/*





Code'd. Please use the Code tags, not text enhancements, as the Code preserves the space. If anyone wants to use your data for testing, they are not going to bother if it has enhancements to delete everywhere.
Back to top
View user's profile Send private message

Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1825
Location: UK

PostPosted: Thu Jul 05, 2012 1:24 pm    Post subject:
Reply with quote

How is it not working? Also, you seem to have managed to use code tags for you JCL and sort cards but not your data and it is just as important, if not more so, to encode your data.
Back to top
View user's profile Send private message
srinathds83

New User


Joined: 17 Jul 2007
Posts: 41
Location: pune

PostPosted: Thu Jul 05, 2012 2:42 pm    Post subject: Reply to: DFSORT Query
Reply with quote

Hi Nic,

when i tried running this Sort Card, It throws an error stating problem with INREC.

Thanks and Regards,

Srinath D.
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1537
Location: Andromeda Galaxy

PostPosted: Thu Jul 05, 2012 2:48 pm    Post subject:
Reply with quote

May be try this

Code:

 OPTION COPY
 INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,2,CH,EQ,C'02'),
 END=(1,4,CH,EQ,C'EOF1'),PUSH=(81:27,6))
 OUTFIL INCLUDE=(1,4,CH,EQ,C'EOF1',AND,81,6,Y2T,EQ,Y'DATE1'-1),
 BUILD=(11,8,9X,C' | ',72,8,52X)
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1825
Location: UK

PostPosted: Thu Jul 05, 2012 3:31 pm    Post subject:
Reply with quote

WHAT error - just post your messages
Back to top
View user's profile Send private message
srinathds83

New User


Joined: 17 Jul 2007
Posts: 41
Location: pune

PostPosted: Thu Jul 05, 2012 4:14 pm    Post subject:
Reply with quote

Pandora-Box wrote:
May be try this

Code:

 OPTION COPY
 INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,2,CH,EQ,C'02'),
 END=(1,4,CH,EQ,C'EOF1'),PUSH=(81:27,6))
 OUTFIL INCLUDE=(1,4,CH,EQ,C'EOF1',AND,81,6,Y2T,EQ,Y'DATE1'-1),
 BUILD=(11,8,9X,C' | ',72,8,52X)



Thanks !!!! This worked perfectly. After changing the Comparision value to Y2T even my Sort Card ran perfectly.

Thanks and Regards,

Srinath
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 Need DB2 query to fetch previous row ! Chandan1993 DB2 10 Sat Jun 03, 2017 10:43 am
No new posts DFSORT - Overriding default option TU... Steve Ironmonger DFSORT/ICETOOL 3 Tue Apr 04, 2017 3:54 pm
No new posts JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts DFSORT MUL FIELDS tspr52 DFSORT/ICETOOL 16 Fri Mar 03, 2017 11:53 pm
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm


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