IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

OUTREC with CONDN


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Anand Kumar

New User


Joined: 29 Aug 2007
Posts: 24
Location: chennai

PostPosted: Tue May 22, 2012 12:49 pm
Reply with quote

Hi,
I have an input file with account no (1:10), Credit-amount(11:5) & Credit-correction-amount(16:5).

Example:
Code:
00000000010000200000
00000000010000200000
00000000020000200000
00000000030000200000
00000000030000200001
00000000040000000001
00000000040000000001
00000000050000200001
00000000050000300001




I have a requirement where I will have to select all the distinct accounts only whose credit-amount <> 0 and credit-correction-amount <> 0 with overlay of A for credit and C for correction.

For the above example:
I will have to select distinct accounts whose credit-amount with an overlay of A in front.

Code:
A0000000001
A0000000002
A0000000003
A0000000005


and also select distinct accounts with credit-correction-amount <> 0 with overlay of C in front.

Code:
C0000000003
C0000000004
C0000000005


so the output file will be:
Code:
A0000000001
A0000000002
A0000000003
A0000000005
C0000000003
C0000000004
C0000000005


It is possible to do this in a single sort card? Can you please help me out with this?

Thank you
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue May 22, 2012 1:01 pm
Reply with quote

With a single sort card? No.

You'll need more than one sort card, but it will be with a single "sort deck" and a single sort deck will only need one job step. Will that do you?
Back to top
View user's profile Send private message
Anand Kumar

New User


Joined: 29 Aug 2007
Posts: 24
Location: chennai

PostPosted: Tue May 22, 2012 1:13 pm
Reply with quote

Hi Bill,

Its OK, can you please help me with the sort deck?
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue May 22, 2012 1:37 pm
Reply with quote

You'll need two OUTFIL statements, one for each file.

On the OUTFIL you can INCLUDE=(state,length,ZD,NE,0) for each of your fields, the BUILD=(C'A' and the data you need for one, and BUILD=(C'C' and the data you need for the other.
Back to top
View user's profile Send private message
hailashwin

New User


Joined: 16 Oct 2008
Posts: 74
Location: Boston

PostPosted: Tue May 22, 2012 5:02 pm
Reply with quote

Try this..
Code:


//STEP0100 EXEC PGM=ICETOOL           
//TOOLMSG  DD SYSOUT=*                 
//DFSMSG   DD SYSOUT=*                 
//IN       DD *                       
00000000010000200000                   
00000000010000200000                   
00000000020000200000                   
00000000030000200000                   
00000000030000200001                   
00000000040000000001                   
00000000040000000001                   
00000000050000200001                   
00000000050000300001                   
//OUT1     DD DSN=XXXX.FORUM5A,
//      DISP=(,CATLG,DELETE),         
//      SPACE=(CYL,(2,2),RLSE),       
//      RECFM=FB                       
//OUT2     DD DSN=XXXX.FORUM5B,
//      DISP=(,CATLG,DELETE),         
//      SPACE=(CYL,(2,2),RLSE),                 
//      RECFM=FB                               
//TOOLIN   DD *                                 
  SORT FROM(IN) TO(OUT1) USING(CTL1)           
  SORT FROM(OUT1) TO(OUT2) USING(CTL2)         
//CTL1CNTL DD *                                 
  OPTION COPY           
  INREC IFTHEN=(WHEN=(11,5,ZD,GT,0),           
              OVERLAY=(32:C'A',1,10),HIT=NEXT),
         IFTHEN=(WHEN=(16,5,ZD,GT,0),           
              OVERLAY=(52:C'C',1,10))           
  OUTFIL FNAMES=OUT1,                           
        OUTREC=(32,11,/,52,11)                 
//CTL2CNTL DD *                                 
  SORT FIELDS=(1,11,CH,A)                       
  OMIT COND=(1,11,CH,EQ,C'           ')         
  SUM FIELDS=NONE                               
//*                                             


Thanks,
Ashwin.
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 23, 2012 1:58 am
Reply with quote

Assuming that the data is already sorted on the key (1,10), the following DFSORT JCL will give you the desired results

The trick here is to the use the same file twice and pick the credit-amount > 0 records from file 1 and build the record as A...... . From File 2 we pick all the records with Credit-correction-amount > 0 and build the record as C......

Now we will match the 2 files and get the desired results.

Code:

//STEP0100 EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//INA      DD *                                                       
00000000010000200000                                                   
00000000010000200000                                                   
00000000020000200000                                                   
00000000030000200000                                                   
00000000030000200001                                                   
00000000040000000001                                                   
00000000040000000001                                                   
00000000050000200001                                                   
00000000050000300001                                                   
00000000060000000000                                                   
00000000070000000000                                                   
//INB      DD *                                                       
00000000010000200000                                                   
00000000010000200000                                                   
00000000020000200000                                                   
00000000030000200000                                                   
00000000030000200001                                                   
00000000040000000001                                                   
00000000040000000001                                                   
00000000050000200001                                                   
00000000050000300001                                                   
00000000060000000000                                                   
00000000070000000000                                                   
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN    DD *                                                       
  OPTION COPY                                                         
  JOINKEYS F1=INA,FIELDS=(1,11,A),SORTED,NOSEQCK                       
  JOINKEYS F2=INB,FIELDS=(1,11,A),SORTED,NOSEQCK                       
  JOIN UNPAIRED                                                       
  REFORMAT FIELDS=(F1:1,11,?,F2:1,11)                                 
  INREC IFOUTLEN=11,IFTHEN=(WHEN=(12,1,CH,EQ,C'2'),BUILD=(13,11))     
  OUTFIL REMOVECC,NODETAIL,SECTIONS=(1,11,TRAILER3=(1,11))             
//*
//JNF1CNTL DD *                 
  INCLUDE COND=(11,5,ZD,GT,0)   
  INREC BUILD=(C'A',1,10) 
//*     
//JNF2CNTL DD *                 
  INCLUDE COND=(16,5,ZD,GT,0)   
  INREC BUILD=(C'C',1,10)       
//*


The output from this is
Code:

A0000000001
A0000000002
A0000000003
A0000000005
C0000000003
C0000000004
C0000000005
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed May 23, 2012 9:30 pm
Reply with quote

Still like mine. You get two files, but you can always concatenate 'em.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts question on Outrec and sort #Digvijay DFSORT/ICETOOL 20
No new posts Sort w/OUTREC Question DFSORT/ICETOOL 2
No new posts Getting OUTREC - SHORT REC error for ... DFSORT/ICETOOL 12
No new posts Issues with outrec overlay while extr... SYNCSORT 7
No new posts SEQNUM with TRA=ETOA in OUTREC SYNCSORT 5
Search our Forums:

Back to Top