MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Manipulating edited input using Sort

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
Jaidev
Beginner


Joined: 05 Jan 2003
Posts: 7
Topics: 4
Location: India

PostPosted: Mon Oct 27, 2003 10:28 am    Post subject: Manipulating edited input using Sort Reply with quote

I need to find out the difference of I/P and O/P for Grand total revenue. Since this is masked field, can I use EDIT in the input of a Sort to get the difference? I tried using the follinwing JCL for this, but it's giving a syntax error:

SORT FIELDS=COPY
OUTREC FIELDS=(1:(46,13,ZD,EDIT=($$,$$$,$99.99CR),ADD,
*
61,13,ZD,EDIT=($$,$$$,$99.99CR)),FS,LENGTH=10)


The Jcl:
//STEP03 EXEC PGM=SYNCSORT
//SORTIN DD DISP=SHR,
// DSN=INPUT1
//SORTOUT DD DSN=TEMP1,
// DISP=OLD,DCB=LRECL=80,
// SPACE=(CYL,(1,5),RLSE)
//SYSIN DD *
SORT FIELDS=COPY
INCLUDE COND=(4,19,CH,EQ,C'GRAND TOTAL REVENUE')
/*
//SYSOUT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSDUMP DD SYSOUT=*
//*
//STEP04 EXEC PGM=SYNCTOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=TEMP1,
// DISP=OLD,DCB=LRECL=80,
// SPACE=(CYL,(1,5),RLSE)
//OUT DD DSN=TEMP,
// DISP=OLD,DCB=LRECL=80,
// SPACE=(CYL,(1,5),RLSE)
//TOOLIN DD *
COPY FROM(IN) TO(OUT) USING(CTL1)
/*
//CTL1CNTL DD *
SORT FIELDS=COPY
OUTREC FIELDS=(1:(46,13,ZD,EDIT=($$,$$$,$99.99CR),ADD,
66,13,ZD,EDIT=($$,$$$,$99.99CR)),FS,LENGTH=10)
/*
//SYSOUT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSDUMP DD SYSOUT=*


The fields positions:
GTR : 4
I/p : 46 - 60 ($$,$$$,$99.$$CR)
o/p : 66 - 80 ($$,$$$,$99.$$CR)

The alternative could be EZ+, but sort can be worth trying.

Snapshot of the input:
FIELD DESCRIPTION I/P DATA O/P DATA
----------------- --------- --------
GRAND TOTAL REVENUE $84.03CR $22.96
TOTAL DDD CHRG AMOUNT $24.50 $24.50
TOTAL CC CHRG AMOUNT $0.00 $0.00


FIELD DESCRIPTION I/P DATA O/P DATA
----------------- --------- --------
GRAND TOTAL REVENUE $61.56 $19.70
TOTAL DDD CHRG AMOUNT $23.76 $23.76
TOTAL CC CHRG AMOUNT $0.00 $0.00



regards,
Jaidev
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12367
Topics: 75
Location: San Jose

PostPosted: Mon Oct 27, 2003 2:38 pm    Post subject: Reply with quote

Jaidev,

shouldn't the edit mask be $$,$$$,$99.99CR instead of $$,$$$,$99.$$CR??

Assuming that the edit mask is correct, there is way to get the desired results. The varying dollar symbol along with thousands seperator , imbedded decimal is what makes this job a little complicated.

I did not have time to test the job but here is a solution that will work.

Split the input file into 'N' different files depending upon the position of the dollar symbol for the input and output data.Here is an untested code.


Code:

//STEP0100 EXEC  PGM=SYNCTOOL                                   
//TOOLMSG  DD SYSOUT=*                                         
//DFSMSG   DD SYSOUT=*                                         
//SYSOUT   DD SYSOUT=*                                         
//IN       DD DSN=YOUR INPUT DSN,
//            DISP=SHR
//T1       DD DSN=&T1,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)
//T2       DD DSN=&T2,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)
//T3       DD DSN=&T3,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)
//T4       DD DSN=&T4,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)
//T5       DD DSN=&T5,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)
//T6       DD DSN=&T6,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)
//T7       DD DSN=&T7,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)
//S1       DD DSN=&S1,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)
//S2       DD DSN=&S2,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)
//S3       DD DSN=&S3,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)
//S4       DD DSN=&S4,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)
//S5       DD DSN=&S5,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)
//S6       DD DSN=&S6,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)
//S7       DD DSN=&S7,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)
//CON      DD DSN=&T1,DISP=OLD,VOL=REF=*.T1     
//         DD DSN=&T2,DISP=OLD,VOL=REF=*.T2     
//         DD DSN=&T3,DISP=OLD,VOL=REF=*.T3     
//         DD DSN=&T4,DISP=OLD,VOL=REF=*.T4     
//         DD DSN=&T5,DISP=OLD,VOL=REF=*.T5     
//         DD DSN=&T6,DISP=OLD,VOL=REF=*.T6     
//         DD DSN=&T7,DISP=OLD,VOL=REF=*.T7     
//         DD DSN=&S1,DISP=OLD,VOL=REF=*.S1     
//         DD DSN=&S2,DISP=OLD,VOL=REF=*.S2     
//         DD DSN=&S3,DISP=OLD,VOL=REF=*.S3     
//         DD DSN=&S4,DISP=OLD,VOL=REF=*.S4     
//         DD DSN=&S5,DISP=OLD,VOL=REF=*.S5     
//         DD DSN=&S6,DISP=OLD,VOL=REF=*.S6     
//         DD DSN=&S7,DISP=OLD,VOL=REF=*.S7     
//OUT      DD DSN=YOUR OUTPUT DSN,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(CYL,(X,Y),RLSE)         
//TOOLIN   DD *               
   COPY FROM(IN) USING(CTL1)   
   SORT FROM(CON) USING(CTL2)   
//CTL1CNTL DD *                           
  INCLUDE COND=(4,19,CH,EQ,C'GRAND TOTAL REVENUE')             
  SORT FIELDS=COPY                                             
  INREC FIELDS=(1,80,SEQNUM,8,ZD)                             
  OUTFIL FNAMES=T1,INCLUDE=(54,1,CH,EQ,C'$'),                 
  OUTREC=(1,25,9C'0',55,1,57,2,X,12C'0',80:X,81,8)             
  OUTFIL FNAMES=T2,INCLUDE=(53,1,CH,EQ,C'$'),                 
  OUTREC=(1,25,8C'0',54,2,57,2,X,12C'0',80:X,81,8 )             
  OUTFIL FNAMES=T3,INCLUDE=(52,1,CH,EQ,C'$'),                 
  OUTREC=(1,25,7C'0',53,3,57,2,X,12C'0',80:X,81,8 )             
  OUTFIL FNAMES=T4,INCLUDE=(50,1,CH,EQ,C'$'),                 
  OUTREC=(1,25,6C'0',51,1,53,3,57,2,X,12C'0',80:X,81,8 )       
  OUTFIL FNAMES=T5,INCLUDE=(49,1,CH,EQ,C'$'),                 
  OUTREC=(1,25,5C'0',50,2,53,3,57,2,X,12C'0',80:X,81,8 )       
  OUTFIL FNAMES=T6,INCLUDE=(48,1,CH,EQ,C'$'),                 
  OUTREC=(1,25,4C'0',49,3,53,3,57,2,X,12C'0',80:X,81,8 )       
  OUTFIL FNAMES=T7,INCLUDE=(46,1,CH,EQ,C'$'),                 
  OUTREC=(1,25,3C'0',47,1,49,3,53,3,57,2,X,12C'0',80:X,81,8 )   

  OUTFIL FNAMES=S1,INCLUDE=(74,1,CH,EQ,C'$'),                   
  OUTREC=(1,25,12C'0',X,9C'0',75,1,77,2,80:X,81,8 )             
  OUTFIL FNAMES=S2,INCLUDE=(73,1,CH,EQ,C'$'),                   
  OUTREC=(1,25,12C'0',X,8C'0',74,2,77,2,80:X,81,8 )             
  OUTFIL FNAMES=S3,INCLUDE=(72,1,CH,EQ,C'$'),                   
  OUTREC=(1,25,12C'0',X,7C'0',73,3,77,2,80:X,81,8 )             
  OUTFIL FNAMES=S4,INCLUDE=(70,1,CH,EQ,C'$'),                   
  OUTREC=(1,25,12C'0',X,6C'0',71,1,73,3,77,2,80:X,81,8 )         
  OUTFIL FNAMES=S5,INCLUDE=(69,1,CH,EQ,C'$'),                   
  OUTREC=(1,25,12C'0',X,5C'0',70,2,73,3,77,2,80:X,81,8 )         
  OUTFIL FNAMES=S6,INCLUDE=(68,1,CH,EQ,C'$'),                   
  OUTREC=(1,25,12C'0',X,4C'0',69,3,73,3,77,2,80:X,81,8 )         
  OUTFIL FNAMES=S7,INCLUDE=(66,1,CH,EQ,C'$'),                   
  OUTREC=(1,25,12C'0',X,3C'0',67,1,69,3,73,3,77,2,X,80:X,81,8 ) 
//CTL2CNTL DD *                                         
  SORT FIELDS=(81,8,ZD,A)                               
  SUM FIELDS=(26,12,ZD,39,12,ZD)                         
  OUTREC FIELDS=(1,55,(26,12,ZD,SUB,39,12,ZD),M3)       
  OUTFIL FNAMES=OUT,                                     
  OUTREC=(01,25,                                         
          26,12,ZD,M3,                                   
          39,12,ZD,M3,                                   
          56,20,80:X )     
/*



Hope this helps...

cheers

kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Jaidev
Beginner


Joined: 05 Jan 2003
Posts: 7
Topics: 4
Location: India

PostPosted: Thu Oct 30, 2003 9:51 am    Post subject: Reply with quote

this JCL indeed worked, with some modifications, thanx a millon...
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group