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

Formatting using DFSORT SPLICE


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
raveendra_ibm
Currently Banned

New User


Joined: 07 Jan 2006
Posts: 31

PostPosted: Fri Feb 16, 2007 2:05 pm
Reply with quote

Hi All,

Here is a requirement that i am working on :

We have two input files : Credit and Debit.

For output we have the following scenarios :

a) Entry present in CR file only => copy as it is into OUT file
b) Entry present in DR file only => change the sign of amount field and write into the OUT file
c) Entry present in both files => subtract amount fields i.e CR - DR and write into OUT file
The amount values displayed are actually in PACKED Decimal format. S9(11)V99 comp-3.

Trailer record contains the count (including header and trailer)

Code:
File-CR Layout

   HDR   XXXX
   DET   A222   100.00
   DET   A333   600.00
   DET   A555   300.00
   DET   A666   400.00
   TRL   0006

Code:
File-DR Layout

   HDR   XXXX
   DET   A111   200.00
   DET   A222   400.00
   DET   A444   700.00
   DET   A555   900.00
   DET   A999   300.00
   TRL   0007


Code:
Desired Output Layout :

   HDR   XXXX
   DET   A111   -200.00      
   DET   A222   -300.00   
   DET   A333    600.00
   DET   A444   -700.00
   DET   A555   -600.00   
   DET   A666    400.00
   DET   A999   -300.00
   TRL   0009


Could you please help me out on this.

Thanks,
Raveendra.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Fri Feb 16, 2007 3:49 pm
Reply with quote

All fixed... icon_biggrin.gif
Raveendra,
If you have looked at other posts on this forum, you may have noticed that most posts have included additional information like lrecl, recfm and such. Take a look and add the info, your help will be available sooner.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Feb 16, 2007 11:48 pm
Reply with quote

Ravenendra,

You don't need SPLICE for this.

Here's a DFSORT/ICETOOL job that will do what you asked for. I assumed that your input files have RECFM=FB and LRECL=80, that the first field is in positions 1-3, the second field in positions 9-12 and the third field (7-byte PD) in positions 15-21.

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN1 DD DSN=...  input file1 (FB/80)
//IN2 DD DSN=...  input file2 (FB/80)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=...  output file (FB/80)
//TOOLIN   DD    *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SORT FROM(T1) USING(CTL3)
/*
//CTL1CNTL DD *
  OMIT COND=(1,3,SS,EQ,C'HDR,TRL')
/*
//CTL2CNTL DD *
  OMIT COND=(1,3,SS,EQ,C'HDR,TRL')
  INREC OVERLAY=(15:15,7,PD,MUL,-1,TO=PD,LENGTH=7)
/*
//CTL3CNTL DD *
  SORT FIELDS=(9,4,CH,A)
  SUM FIELDS=(15,7,PD)
  OUTFIL FNAMES=OUT,REMOVECC,
    HEADER1=(C'HDR',9:C'XXXX'),
    TRAILER1=(C'TRL',9:COUNT+2=(EDIT=(TTTT)))
/*
Back to top
View user's profile Send private message
raveendra_ibm
Currently Banned

New User


Joined: 07 Jan 2006
Posts: 31

PostPosted: Sat Feb 17, 2007 11:30 am
Reply with quote

Thanks a lot Frank.. Its working !!!!

William,
Quote:
Take a look and add the info, your help will be available sooner
Taken a note of the same. Would provide all the necessary details in my subsequent posts. Thank you.

Regards,
Raveendra
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 Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts DFsort help with SUM() DFSORT/ICETOOL 12
No new posts Join multiple records using splice DFSORT/ICETOOL 5
Search our Forums:

Back to Top