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
 

 

OUTREC with CONDN

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: OUTREC with CONDN
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Tue May 22, 2012 1:01 pm    Post subject: Reply to: OUTREC with CONDN
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    Post subject: Reply to: OUTREC with CONDN
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Tue May 22, 2012 1:37 pm    Post subject: Reply to: OUTREC with CONDN
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: 73
Location: Boston

PostPosted: Tue May 22, 2012 5:02 pm    Post subject:
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    Post subject: Reply to: OUTREC with CONDN
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Wed May 23, 2012 9:30 pm    Post subject: Reply to: OUTREC with CONDN
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    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 outrec field outside range Danielle.Filteau SYNCSORT 10 Sat Mar 04, 2017 2:37 am
No new posts SORT- outrec ram_vizag DFSORT/ICETOOL 10 Tue Sep 27, 2016 12:50 am
No new posts OUTREC FILELDS FAILS WITH ICE126A 2 ... balaji81_k DFSORT/ICETOOL 8 Sat Jul 02, 2016 1:22 am
No new posts OUTREC RDW NOT INCLUDED krsenthil85 SYNCSORT 10 Fri May 06, 2016 3:22 am
No new posts OUTREC on OUTFIL error rocky_balboa DFSORT/ICETOOL 4 Thu Aug 27, 2015 10:26 am


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