Empty Report Line



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

Empty Report Line

Postby Dean » Sat Jul 14, 2012 12:09 am

Hi.

I have produced a report that I expect will return no results from time to time.
What I am currently doing is this :
TRAILER1=(25:'NUMBER OF RECORDS SELECTED: ',COUNT=(M11,LENGTH=3),2/,

However, this will appear at the bottom of every report. What I would like is the following output line only when the sort returns no results
No results for this report


I saw a post on the forum where I could do it by adding a second job step to conditionally execute using NULLOUT in the first step.
Is there a way to accomplish this all in one sort step?

Thanks
Dean
 
Posts: 9
Joined: Fri Jul 13, 2012 8:12 pm
Has thanked: 3 times
Been thanked: 0 time

Re: Empty Report Line

 

Re: Empty Report Line

Postby dick scherrer » Sat Jul 14, 2012 1:11 am

Hello and welcome to the forum,

Is there some reaslon the trailer with a COUNT of zero would not work?
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: Empty Report Line

Postby Dean » Sat Jul 14, 2012 1:31 am

No. It works just fine. It's just that the shop "standard" is different and I am trying to mimic those standards to develop a DFSort "template" for simple reporting where creating a new COBOL program is overkill. I am very new to DFsort but have been very impressed with it's capabilities. So far I have been able to get it to do exactly what I want in every case....except this one.
Dean
 
Posts: 9
Joined: Fri Jul 13, 2012 8:12 pm
Has thanked: 3 times
Been thanked: 0 time

Re: Empty Report Line

Postby skolusu » Sat Jul 14, 2012 4:44 am

Dean wrote:However, this will appear at the bottom of every report. What I would like is the following output line only when the sort returns no results


DFSORT does not have any built-in features to dynamically adjust the Headerx/trailerx. Your best bet would be

Dean wrote:I saw a post on the forum where I could do it by adding a second job step to conditionally execute using NULLOUT in the first step.
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: Empty Report Line

Postby Dean » Mon Jul 16, 2012 10:59 pm

Thanks Guys,

One last idea. is there a way to test for the Return code in the OUTREC uisng an IFTHEN to build a custom line like

OUTREC IFTHEN=(WHEN=(RC4, BUILD=('NO RECORDS SELECTED')
Dean
 
Posts: 9
Joined: Fri Jul 13, 2012 8:12 pm
Has thanked: 3 times
Been thanked: 0 time

Re: Empty Report Line

Postby skolusu » Mon Jul 16, 2012 11:46 pm

Dean wrote:Thanks Guys,

One last idea. is there a way to test for the Return code in the OUTREC uisng an IFTHEN to build a custom line like

OUTREC IFTHEN=(WHEN=(RC4, BUILD=('NO RECORDS SELECTED')


Dean,

You canNOT check the RC using IFTHEN. INREC/OUTREC all work on data records. So if your file is empty, the inrec/outrec statements will not be executed.

You can create a file with the text "$$$$ NO RESULTS FOR THIS REPORT " and concatenate it to the input file. And now we can control what text we want to write out based on the input.

ex: Assuming you have 3 records you run the job as shown below
//STEP0100 EXEC PGM=SORT                                   
//SYSOUT   DD SYSOUT=*                                     
//SORTIN   DD *                                           
----+----1----+----2----+----3----+----4----+----5----+----
RECORD - 1                                                 
RECORD - 2                                                 
RECORD - 3                                                 
//         DD *                                           
$$$$                    NO RESULTS FOR THIS REPORT         
//SORTOUT  DD SYSOUT=*                                     
//SYSIN    DD *                                           
  SORT FIELDS=COPY                                         
  INREC IFOUTLEN=80,                                       
  IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,3,ZD,START=0)),     
  IFTHEN=(WHEN=(1,4,CH,EQ,C'$$$$',AND,81,3,ZD,GT,0),       
  OVERLAY=(24X,C'NUMBER OF RECORDS SELECTED: ',81,3)),     
  IFTHEN=(WHEN=(1,4,CH,EQ,C'$$$$',AND,81,3,ZD,EQ,0),       
  OVERLAY=(24X))                                           
//*


The output of this is :
RECORD - 1                                               
RECORD - 2                                               
RECORD - 3                                               
                        NUMBER OF RECORDS SELECTED: 003   


Now lets say your input file is empty , then run the same jcl and the output would be
                        NO RESULTS FOR THIS REPORT 


This is the job that produces that output (check how SORTIN DD * does not have any records.
//STEP0100 EXEC PGM=SORT                               
//SYSOUT   DD SYSOUT=*                                 
//SORTIN   DD *                                         
//         DD *                                         
$$$$                    NO RESULTS FOR THIS REPORT     
//SORTOUT  DD SYSOUT=*                                 
//SYSIN    DD *                                         
  SORT FIELDS=COPY                                     
  INREC IFOUTLEN=80,                                   
  IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,3,ZD,START=0)), 
  IFTHEN=(WHEN=(1,4,CH,EQ,C'$$$$',AND,81,3,ZD,GT,0),   
  OVERLAY=(24X,C'NUMBER OF RECORDS SELECTED: ',81,3)), 
  IFTHEN=(WHEN=(1,4,CH,EQ,C'$$$$',AND,81,3,ZD,EQ,0),   
  OVERLAY=(24X))                                       
//*
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

These users thanked the author skolusu for the post (total 2):
Nik22Dec (Tue Jul 24, 2012 3:20 pm) • Dean (Fri Jul 20, 2012 8:54 pm)
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: Empty Report Line

Postby Dean » Fri Jul 20, 2012 9:04 pm

Thanks for the great solution!! I have been adapting it to my shop's standards.

I am having one last issue I hope you can help me with.

I an getting
ICE043A 3 INVALID DATA SET ATTRIBUTES: SORTIN   LRECL   - REASON CODE IS 05
The reason being that my input data LRECL is 155 and I am using the technique you demonstrated
//        DD *                             
$$$$           NO RESULTS FOR THIS REPORT
which I beleieve is defaulting to a length of 80. I like the inline code technique for clarity. Is there any way to resolve this besides alocatting a dataset with an LRECL of 155 an putting the "no results" record in that??

Thanks Again
Dean
 
Posts: 9
Joined: Fri Jul 13, 2012 8:12 pm
Has thanked: 3 times
Been thanked: 0 time

Re: Empty Report Line

Postby skolusu » Fri Jul 20, 2012 10:08 pm

Dean wrote:Thanks for the great solution!! I have been adapting it to my shop's standards.

I am having one last issue I hope you can help me with.

I an getting
ICE043A 3 INVALID DATA SET ATTRIBUTES: SORTIN   LRECL   - REASON CODE IS 05
The reason being that my input data LRECL is 155 and I am using the technique you demonstrated
//        DD *                             
$$$$           NO RESULTS FOR THIS REPORT
which I beleieve is defaulting to a length of 80. I like the inline code technique for clarity. Is there any way to resolve this besides alocatting a dataset with an LRECL of 155 an putting the "no results" record in that??

Thanks Again


Dean,

If you had looked up the ICE043A message and the reason code you would have found the problem. Here is the explanation of the error.

http://publibz.boulder.ibm.com/cgi-bin/ ... m60/2.2.42?

I showed you an example using LRECL=80 , but looks like your input is off different length. You canNOT concatenate different LRECL FB files. So you need to create the trailer record file similar to your input file.
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: Empty Report Line

Postby Dean » Fri Jul 20, 2012 10:47 pm

Thanks.

Maybe my my question wasn't clear and I guess it is more of a JCl question than a DFSORT question. I did look up the error code and I understand that the unequal lengths is the issue. My question is, is there a way to keep the inline DD* for the trailer message and still force it to be LRECL 155 rather than allocating a file just to hold that one line.
I guess the answer is no.

I'm not a real JCL pro either. My experience has been in VSAM/CICS
Dean
 
Posts: 9
Joined: Fri Jul 13, 2012 8:12 pm
Has thanked: 3 times
Been thanked: 0 time

Re: Empty Report Line

Postby skolusu » Fri Jul 20, 2012 11:06 pm

Dean wrote:Thanks.

Maybe my my question wasn't clear and I guess it is more of a JCl question than a DFSORT question. I did look up the error code and I understand that the unequal lengths is the issue. My question is, is there a way to keep the inline DD* for the trailer message and still force it to be LRECL 155 rather than allocating a file just to hold that one line.
I guess the answer is no.

I'm not a real JCL pro either. My experience has been in VSAM/CICS


Dean,

Unfortunately you cannot use instream data to force a large lrecl. however you can use the following step to write the trailer record.
//STEP0100 EXEC PGM=IDCAMS                             
//SYSPRINT DD SYSOUT=*                                 
//INP      DD DISP=SHR,DSN=Your input file in question
//EMT      DD *                                         
$$$$                    NO RESULTS FOR THIS REPORT     
//SYSIN    DD *                                         
  PRINT INFILE(INP) CHARACTER COUNT(1)                 
  IF LASTCC = 4 THEN DO                                 
     REPRO INFILE(EMT) OUTFILE(INP)                     
//*
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

These users thanked the author skolusu for the post:
Dean (Fri Jul 20, 2012 11:38 pm)
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post