Getting incorrect result of Trailer value in JCL



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Getting incorrect result of Trailer value in JCL

Postby aakumari » Fri Jan 31, 2020 4:21 pm

Hi All,

My job has 2 datasets (random number have taken) as input, it has total of document and total of sheet. I have to print below:

1. jobs name in which these datasets are processed
2. Total of document count
3. Total of sheet count
4. Total of document and sheet
5. Total number of job

Above will be confusing so giving below for reference:

Dataset1:
JOBNAME1_07052017_20170705234939.txt       |0023301|Y|00098702|
 

Dataset2:
JOBNAME_07052017_20170705234939.txt       |0023301|Y|00098702|


Output dataset should have:
JOBNAME           DOCUMENT COUNT           SHEET COUNT
-------           --------------           -----------
JOBNAME1                 23,301                98,702
JOBNAME                       1                     1
TOTALS                   23,302                98,703  
                                                       
TOTAL NUMBER OF JOBS =       2                        
 

I am getting proper result in 3 step:
Step1:
OPTION COPY                                                      
OUTFIL REMOVECC,                                                  
  HEADER1=(1:' CCC930',21:'xxxxxxxxxxxxxxxxxxxxxxxxxxx ',        
           49:10X,59:'DATE : ',66:&DATE,1/,1/,                    
           1:' JOBNAME',20:'DOCUMENT COUNT',45:'SHEET COUNT',1/,  
           1:' -------',20:'--------------',45:'-----------')    
  OUTREC FIELDS=(2:18,8,10:14X,25:61,7,ZD,EDIT=(I,III,IIT),      
          34:12X,46:71,8,ZD,EDIT=(II,III,IIT),56:25X)            
  INREC FINDREP=(IN=C'_',OUT=C' ')                                


Step2:
OUTFIL REMOVECC,NODETAIL,                                        
  TRAILER2=(2:'TOTALS  ',10:14X,25:TOT=(61,7,ZD,EDIT(I,III,IIT)),
       34:12X,46:TOT=(71,8,ZD,EDIT(II,III,IIT)),56:25X),          
  TRAILER1=(1/,1:' TOTAL NUMBER OF JOBS = ',25:COUNT)            
 

Step3:
SORT FIELDS=COPY  
END              



When I am trying to keep both header and trailer in same sort card I am getting incorrect value in TRAILER2.

OPTION COPY                                                          
OUTFIL REMOVECC,                                                    
  HEADER1=(1:' CCC930',21:'XXXXXXXXXXXXXXXXXXXXXXXXXXX ',            
           49:10X,59:'DATE : ',66:&DATE,1/,1/,                      
           1:' JOBNAME',20:'DOCUMENT COUNT',45:'SHEET COUNT',1/,    
           1:' -------',20:'--------------',45:'-----------'),      
  TRAILER2=(2:'TOTALS  ',10:14X,25:TOT=(61,7,ZD,EDIT(I,III,IIT)),    
       34:12X,46:TOT=(71,8,ZD,EDIT(II,III,IIT)),56:25X),            
  TRAILER1=(1/,1:' TOTAL NUMBER OF JOBS = ',25:COUNT)                
  OUTREC FIELDS=(2:18,8,10:14X,25:61,7,ZD,EDIT=(I,III,IIT),          
          34:12X,46:71,8,ZD,EDIT=(II,III,IIT),56:25X)                
  INREC FINDREP=(IN=C'_',OUT=C' ')                                  
 

please help to get this done in single step.

Thanks,
aakumari
aakumari
 
Posts: 4
Joined: Fri Jan 31, 2020 4:02 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Getting incorrect result of Trailer value in JCL

Postby NicC » Fri Jan 31, 2020 4:40 pm

1 - not a JCL question but a sort question - assumed to be DFSort
2 - post your code and data using the code tgas to maintain alignment
3 - they are datasets not files
4 - do not post the same question more than once - ANYWHERE
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: Getting incorrect result of Trailer value in JCL

Postby aakumari » Mon Feb 03, 2020 12:12 pm

Hi Nic,

Thanks for information, will take care of these.

It would be great if I will get response on my query.

Regards,
Aakumari
aakumari
 
Posts: 4
Joined: Fri Jan 31, 2020 4:02 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Getting incorrect result of Trailer value in JCL

Postby sergeyken » Mon Feb 03, 2020 9:05 pm

1) Where is your JCL sample?

2) How do you plan to process TWO input datasets (one record each???!!!) while using SORT statements to handle one single input???
Javas and Pythons come and go, but JCL and SORT stay forever.
User avatar
sergeyken
 
Posts: 438
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 7 times
Been thanked: 40 times

Re: Getting incorrect result of Trailer value in JCL

Postby aakumari » Tue Feb 04, 2020 3:04 pm

Hi, posting my sample JCL as:
//STEP0001 EXEC PGM=SORT                                              
//SORTIN   DD DSN=TXXXXXX.XXX012.SXXXXUT.AQQQ.RPT(+0),DISP=SHR        
//         DD DSN=TXXXXXX.XXX012A.SXXXXUT.AQQQ.RPT(+0),DISP=SHR      
//SORTOUT  DD DSN=TXXXXXX.XXX.XXXXXXX.REPORT.FMT(+1),                  
//            DISP=(NEW,CATLG,DELETE),                                
//            LRECL=80,                                                
//            DATACLAS=DATAFX                                          
//SYSIN    DD *                                                        
  OPTION COPY                                                          
  OUTFIL REMOVECC,                                                    
    HEADER1=(1:' CCC930',21:'CCC PRINT JOB DETAIL REPORT ',            
             49:10X,59:'DATE : ',66:&DATE,1/,1/,                      
             1:' JOBNAME',20:'DOCUMENT COUNT',45:'SHEET COUNT',1/,    
             1:' -------',20:'--------------',45:'-----------'),      
    TRAILER2=(2:'TOTALS  ',10:14X,25:TOT=(61,7,ZD,EDIT(I,III,IIT)),    
          34:12X,46:TOT=(71,8,ZD,EDIT(II,III,IIT)),56:25X),            
    TRAILER1=(1/,1:' TOTAL NUMBER OF JOBS = ',25:COUNT)                
    OUTREC FIELDS=(2:18,8,10:14X,25:61,7,ZD,EDIT=(I,III,IIT),          
            34:12X,46:71,8,ZD,EDIT=(II,III,IIT),56:25X)                
    INREC FINDREP=(IN=C'_',OUT=C' ')                                  
//SYSPRINT DD SYSOUT=*        
//SYSOUT   DD SYSOUT=*        
//SYSUDUMP DD SYSOUT=*
aakumari
 
Posts: 4
Joined: Fri Jan 31, 2020 4:02 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Getting incorrect result of Trailer value in JCL

Postby sergeyken » Tue Feb 04, 2020 7:38 pm

1) If you are using concatenated input files, from the point of view of application (e.g. SORT utility) it is ONE SINGLE DATASET. No need to make your example more complicated than it is.

2) What exactly is "I am getting incorrect value in TRAILER2"?????

3) Your example, when copied as it is, including your sample of input data, gives ABEND S0C7 (incorrect decimal data). Looks like the positions in two line of your input data are different!? What else is wrong? - try to find by yourself.

People who spend their own time trying to help you are not obliged to dig for your own typos, missing information, wrong data, etc.
Javas and Pythons come and go, but JCL and SORT stay forever.
User avatar
sergeyken
 
Posts: 438
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 7 times
Been thanked: 40 times

Re: Getting incorrect result of Trailer value in JCL

Postby sergeyken » Tue Feb 04, 2020 8:27 pm

First of all, comment-out all your ZD,EDIT= parts of OUTREC statement, and full TRAILER2 parameter.


  OUTREC FIELDS=(2:18,8,                                            
                  10:14X,                                          
                  25:61,7, ZD,EDIT=(I,III,IIT),                    
                  34:12X,                                          
                  46:71,8, ZD,EDIT=(II,III,IIT),                  
                  56:25X)                                          
 OUTFIL REMOVECC,                                                  
    HEADER1=(1:' CCC930',                                          
            21:'CCC PRINT JOB DETAIL REPORT ',                    
            49:10X,                                                
            59:'DATE : ',                                          
            66:&DATE,                                              
            //,' JOBNAME',                                        
            20:'DOCUMENT COUNT',                                  
            45:'SHEET COUNT',1/,                                  
             /,' -------',20:'--------------',45:'-----------'),  
*   TRAILER2=(2:'TOTALS  ',                                        
*            10:14X,                                              
*            25:TOT=(61,7,ZD,EDIT(I,III,IIT)),                    
*            34:12X,                                              
*            46:TOT=(71,8,ZD,EDIT(II,III,IIT)),                    
*            56:25X),                                              
    TRAILER1=(/,1:' TOTAL NUMBER OF JOBS = ',                      
               25:COUNT)                                          


Take a look: what stupid data your are trying to process!!!

********************************* TOP OF DATA ********************************
 CCC930             CCC PRINT JOB DETAIL REPORT           DATE : 02/04/20    
                                                                             
 JOBNAME           DOCUMENT COUNT           SHEET COUNT                      
                                                                             
 -------           --------------           -----------                      
  2017070               02|                                                  
 20170705               2|                                                    
                                                                             
 TOTAL NUMBER OF JOBS =        2                                              
******************************** BOTTOM OF DATA ******************************
 

Calculation of correct positions of YOUR input data - it is YOUR OWN responsibility, not the task to be done by forum members. :cry:
Javas and Pythons come and go, but JCL and SORT stay forever.
User avatar
sergeyken
 
Posts: 438
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 7 times
Been thanked: 40 times

Re: Getting incorrect result of Trailer value in JCL

Postby aakumari » Wed Feb 05, 2020 8:34 am

Hi,

Not sure why result is not proper for you. But I am getting the correct result except in TRAILER2 when I am keeping header and both trailers in single step. Please check my result:

 Command ===>                                                  Scroll ===> CSR  
********************************* Top of Data **********************************
 CCC930             CCC PRINT JOB DETAIL REPORT           DATE : 02/03/20      
                                                                               
 JOBNAME           DOCUMENT COUNT           SHEET COUNT                        
 -------           --------------           -----------                        
 PCCC012                   23,301                98,702                        
 PCCC012A                       1                     1                        
 PCCC012M                       2                    19                        
 PCCC012N                      10                     0                        
 PCCC012R                      23                    21                        
 PCCC012Y                       1                     2                        
 PCCC013                        1                     9                        
 PCCC013A                       6                     6                        
 PCCC013B               1,330,006            98,000,006                        
 PCCC013M                       6                     6                        
 PCCC013R                       6                     6                        
 PCCC013Y                       6                     6                        
 PCCC014                      477                   763                        
 PCCC014A                       6                     6                        
 PCCC014B                       2                     7                        
 PCCC037                        6                     6                        
 PCCC037B                       6                     6                        
 TOTALS                 1,354,003            98,099,858                   
                                                                               
 TOTAL NUMBER OF JOBS =       43                                                
******************************** Bottom of Data ********************************

Alignment is completely correct. When I am using 2 different steps, one for header and one for trailer then getting expected result.
aakumari
 
Posts: 4
Joined: Fri Jan 31, 2020 4:02 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Getting incorrect result of Trailer value in JCL

Postby dneufarth » Wed Feb 05, 2020 9:20 am

Your sample data for dataset2 shows the data after file name (.txt) to be shifted 1 byte left because jobname is 1 byte less than jobname in dataset1.

Long time since I’ve used SORT, so not sure if your control statements handle this.

Perhaps the example data is simply a typo.
dneufarth
 
Posts: 23
Joined: Thu Oct 15, 2009 2:50 am
Has thanked: 1 time
Been thanked: 2 times

Re: Getting incorrect result of Trailer value in JCL

Postby sergeyken » Wed Feb 05, 2020 6:39 pm

aakumari wrote:Not sure why result is not proper for you.

Because:
1) the example posted to the forum is different from what you are using in your tests. IT IS NOT WORKING WHEN COPIED FROM YOUR POST! - the result of that attempt has been attached above. Nobody is going to adjust YOUR examples instead of YOURSELF
2) the style of alignment of the code in your example prevents others from reading it, and understanding it

aakumari wrote:But I am getting the correct result except in TRAILER2 when I am keeping header and both trailers in single step. Please check my result:
You are getting the correct(?) result because you are using code from your own libraries, not exactly the code you've posted at the forum.

aakumari wrote:Alignment is completely correct. When I am using 2 different steps, one for header and one for trailer then getting expected result.

1) Alignment IN YOUR EXAMPLES is incorrect, no doubt. Period.
2) What are your "expected results" vs. "unexpected ones"?
Javas and Pythons come and go, but JCL and SORT stay forever.
User avatar
sergeyken
 
Posts: 438
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 7 times
Been thanked: 40 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post