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 

Adding Numbers

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
sateesh_gontla
Beginner


Joined: 23 Jan 2004
Posts: 40
Topics: 16
Location: Bangalore

PostPosted: Fri Jan 23, 2004 7:14 am    Post subject: Adding Numbers Reply with quote

Input :

ABC : 1000
XYZ : 1000
PQR : 1000


Output should be like this :


ABC : 1000
XYZ : 1000
PQR : 1000

Total : 3000
_________________
Regards,
Sateesh
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Jan 23, 2004 7:28 am    Post subject: Reply with quote

Sateesh,

There is a similar requirement which was posted a few mins ago.

http://www.mvsforums.com/helpboards/viewtopic.php?t=1706

Any way here is a JCl which will give you desired results.

Code:

//STEP0100 EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD *
ABC : 1000
XYZ : 1000
PQR : 1000
//SORTOUT  DD SYSOUT=*                                         
//SYSIN    DD    *                                             
  SORT FIELDS=COPY                                             
  OUTFIL REMOVECC,                                             
      TRAILER1=('TOTAL:',TOTAL=(7,4,ZD,M10),80:X)
/*


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
sateesh_gontla
Beginner


Joined: 23 Jan 2004
Posts: 40
Topics: 16
Location: Bangalore

PostPosted: Fri Jan 23, 2004 7:42 am    Post subject: Reply with quote

Hi Kolusu,

Thx a lot.

But I am getting this error :

SYSIN :
SORT FIELDS=COPY
OUTFIL REMOVECC,
*
TRAILER1=('TOTAL :',TOTAL=(8,8,ZD,M10),80:X)
WER268A OUTFIL STATEMENT : SYNTAX ERROR
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000

code is like this :
//SE900011 EXEC PGM=SORT
//SORTIN DD DSN=FV99T.SE2900.SE2800.TRANCNTS(+10),DISP=SHR
//*
//SORTOUT DD DSN=FV99T.SE2900.SE2800.TRANCNTS(+11),
// DISP=(NEW,CATLG,DELETE),
// SPACE=(80,(100,20),RLSE),
// AVGREC=K,LRECL=80,DATACLAS=DATAF
//*
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL REMOVECC,
TRAILER1=('TOTAL :',TOTAL=(8,8,ZD,M10),80:X)
/*
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Jan 23, 2004 8:38 am    Post subject: Reply with quote

Sateesh,

The error you are getting might be due to the parm REMOVECC. I guess you have an old version of syncsort. you need syncsort for z/os 1.1 or higher for removecc parm to work.

Also there are couple of errors in your post. You don't need SYSPRINT dd statement for sort program. Also your output dataset is allocated as +11, which in real is you want to create a +1 generation of the dataset. You also don't have to provide the LRECL parm with sort. Sort products automatically calculate the LRECL & BLKSIZE.

I don't think you need both DATACLAS and space parameter.you can code just either one of them.

There is an alternate version of the same solution but it involves two passes

A brief explanation of the job. Whenever you use report features like trailer, header it will create a file with a carriage control character at the beginning of the file. so we create a temp file with the carriage control and later on remove it from the file.

Code:


//SE900011 EXEC PGM=SYNCTOOL
//TOOLMSG  DD SYSOUT=*
//DFSMSG   DD SYSOUT=*
//IN       DD DSN=FV99T.SE2900.SE2800.TRANCNTS(+10),
//            DISP=SHR 
//T1       DD DSN=&T1,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)
//OUT      DD DSN=FV99T.SE2900.SE2800.TRANCNTS(+1),
//            DISP=(NEW,CATLG,DELETE),
//            SPACE=(80,(100,20),RLSE),
//            DATACLAS=DATAF,RECFM=FB
//*
//TOOLIN   DD *
   COPY FROM(IN) USING(CTL1)
   COPY FROM(T1) USING(CTL2)
//CTL1CNTL DD *
   OUTFIL FNAMES=T1,TRAILER1=('TOTAL :',TOTAL=(8,8,ZD,M10),80:X)
//CTL2CNTL DD *
   OUTFIL FNAMES=OUT,OUTREC=(2,80)
/*


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
sateesh_gontla
Beginner


Joined: 23 Jan 2004
Posts: 40
Topics: 16
Location: Bangalore

PostPosted: Fri Jan 23, 2004 9:48 am    Post subject: Reply with quote

Now the error is like this :

SYT000I SYNCTOOL RELEASE 1.4A - COPYRIGHT 2001 SYNCSORT INC.
SYT001I INITIAL PROCESSING MODE IS "STOP"
SYT002I "TOOLIN" INTERFACE BEING USED

COPY FROM(IN) USING(CTL1)
SYT020I SYNCSORT CALLED WITH IDENTIFIER "0001"
SYT012E SYNCSORT COMPLETED UNSUCCESSFULLY
SYT030I OPERATION COMPLETED WITH RETURN CODE 16

SYT015I PROCESSING MODE CHANGED FROM "STOP" TO "SCAN" DUE TO OPERATION FAILURE

COPY FROM(T1) USING(CTL2)
SYT019I STATEMENT VALID; NOT PROCESSED DUE TO "SCAN" PROCESSING MODE

SYT004I SYNCTOOL PROCESSING COMPLETED WITH RETURN CODE 16

*********************

SYNCSORT FOR Z/OS 1.1BRI TPF1A U.S. PATENTS: 4210961, 5117495 (C) 2002 SYNC
AMERICAN EXPRESS TRS IPC OS/390 2.10.
PRODUCT LICENSED FOR CPU SERIAL NUMBER 13C3A, MODEL 2064 LICEN
CTL1CNTL :
OUTFIL FNAMES=T1,TRAILER1=('TOT',TOTAL=(8,8,ZD,M10),80:X) 0050000
PARMLIST :
OPTION RESINV=0,ARESINV=0,MSGDDN=DFSMSG,SORTIN=IN,SORTDD=CTL1,COPY
WER428I CALLER-PROVIDED IDENTIFIER IS "0001"
WER164B 5,728K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,
WER164B 0 BYTES RESERVE REQUESTED, 1,020K BYTES USED
WER146B 4K BYTES OF EMERGENCY SPACE ALLOCATED
WER108I IN : RECFM=FB ; LRECL= 15; BLKSIZE= 27990
WER110I T1 : RECFM=FBA ; LRECL= 16; BLKSIZE= 27984
WER230A T1 HEADER/TRAILER COL FIELD OUTSIDE RANGE
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
_________________
Regards,
Sateesh
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Jan 23, 2004 10:22 am    Post subject: Reply with quote

Sateesh,

Whenever you post a question make sure that you post all the details like LRECL,RECFM sample input & desired output and the product at your shop.

I assumed that your input file is of 80 bytes lrecl due to lack of information.

From your error messages your input lrecl is only 15 bytes.so you need to change the control
cards CTL1 & CTL2 to the following

Code:

//CTL1CNTL DD *                                                   
   OUTFIL FNAMES=T1,TRAILER1=('TOTAL: ',TOTAL=(7,4,ZD,LENGTH=5)) 
//CTL2CNTL DD *                                                   
   OUTFIL FNAMES=OUT,OUTREC=(2,15)                               
/*


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL) 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