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 

Insert one blank line in output file

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


Joined: 02 Dec 2002
Posts: 629
Topics: 176
Location: Stockholm, Sweden

PostPosted: Thu Feb 01, 2018 11:45 am    Post subject: Insert one blank line in output file Reply with quote

For various reasons, I need to insert a blank line into my input file before sending it to a network printer (if I don't, the system (JES ?) "steals" the first record and it never gets printed.

I tried the following (which seems to be wrong)
Code:

//SORT    EXEC PGM=SORT                                   
//*-------------------------------------------------     
//*  HARDCOPY PRINT SA4                                   
//*-------------------------------------------------     
//SORTIN    DD DISP=SHR,DSNAME=SIMMIC.COPY.COBOL(AT55PARM)
//*SORTOUT   DD DSN=&&TEMP,DISP=(MOD,KEEP,DELETE)         
//SORTOUT   DD DSN=SIMMIC.TEMP.FILE,DISP=(MOD,KEEP,DELETE)
//SYSPRINT  DD SYSOUT=*                                   
//SYSOUT    DD SYSOUT=*                                   
//SYSIN     DD *                                         
  OPTION COPY                                             
  OUTFIL REMOVECC HEADER1=(1:' ')                         
//*                                                       

based on an example I found elsewhere.

When I review SIMMIC.TEMP.FILE there is no extra blank line at the top.

My input fle looks like this (at the top)

Quote:
******************************************************************
* PARAMETER FÖR ANROP AV KAT550 (Kolla reg.nr).
* ANROP:


and I simply want it to look like this instead
Quote:

******************************************************************
* PARAMETER FÖR ANROP AV KAT550 (Kolla reg.nr).
* ANROP:


What do I need to change in the SYSIN statements ?

Thanks
_________________
Michael
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Feb 01, 2018 12:40 pm    Post subject: Reply with quote

misi01,

You are missing a comma after REMOVECC parm and your header1 parm is treated as a comment. By default we write at position 1 for FB files and position 5 for VB files , so you really don't have to specify the position.

so use

Code:

OUTFIL REMOVECC,HEADER1=(X)   


Also did you notice the DISP parm on the SORTOUT dataset? It has MOD So you data is appended at the end. So change that to NEW,CATLG,DELETE and re-run your job.
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
misi01
Advanced


Joined: 02 Dec 2002
Posts: 629
Topics: 176
Location: Stockholm, Sweden

PostPosted: Fri Feb 02, 2018 1:50 am    Post subject: Reply with quote

Thanks (the DISP error was an irritating newbie I should have spotted).

Now to a variation on the first question. It seems that JES is pinching the first character in the file and using it for some purpose or other (it's gone when the file is finally printed).
What I want to do now is simply prepend a blank column to the file. I tried variations on the following
Code:

//SYSIN     DD *             
  SORT FIELDS=COPY           
  OUTREC BUILD=(1:C' ',2,1:)

but keep getting RC 16.

Note that the "theory" behind the last 1: is because I want DFSORT to copy from position 1 in the input file to the end, and I don't know in advance what the LRECL is of the FB file. How should I do this (I've tried googling, but whichever variation I attempted didn't seem to work)

In addition, a variation on my first append in this topic; how would I insert a blank line after every (say) 50 records ?
_________________
Michael
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Feb 02, 2018 11:30 am    Post subject: Reply with quote

misi01 wrote:
Thanks (the DISP error was an irritating newbie I should have spotted).

Now to a variation on the first question. It seems that JES is pinching the first character in the file and using it for some purpose or other (it's gone when the file is finally printed).


misi01,

SDSF by default adds an carriage control character to its display. When you write to the dataset it will be written as is without the carriage control assuming it is not a report and you deliberately suppressed the carriage control character with parms like REMOVECC

misi01 wrote:

What I want to do now is simply prepend a blank column to the file. I tried variations on the following
Code:

//SYSIN     DD *             
  SORT FIELDS=COPY           
  OUTREC BUILD=(1:C' ',2,1:)

but keep getting RC 16.

Note that the "theory" behind the last 1: is because I want DFSORT to copy from position 1 in the input file to the end, and I don't know in advance what the LRECL is of the FB file. How should I do this (I've tried googling, but whichever variation I attempted didn't seem to work)


For Fixed Length Records you do need to provide the starting position and ending position to be copied. For Variable Length Records , you can just specify the start position and DFSORT under the covers will determine the length using the RDW and write out the records. If you want to use the same control card to copy files with different LRECL's then you need to LISTDS the dataset in question and generate the INREC statement. see the example below



misi01 wrote:

In addition, a variation on my first append in this topic; how would I insert a blank line after every (say) 50 records ?


Quite simple. Use the parm LINES=n (where "n" is the number where you want to insert a new line) on OUTFIL

Code:

// SET IDSN='HLQ.SLQ.TLQ.FILE'                             
//*                                                             
//***************************************************************
//* GET THE FILE DCB PROPERTIES USING LISTDS COMMAND            *
//***************************************************************
//STEP0100 EXEC PGM=IKJEFT01,PARM='LISTDS ''&IDSN'''             
//SYSTSPRT DD DSN=&&L,DISP=(,PASS),SPACE=(TRK,(1,0),RLSE),       
//            DCB=(LRECL=80,RECFM=FB,BLKSIZE=0)                 
//SYSTSIN  DD DUMMY                                             
//*                                                             
//***************************************************************   
//* READ LISTDS OUTPUT AND CREATE INREC STATEMENTS FOR ADDING   *
//* A SPACE AT THE BEGINNING                                    *   
//* THE LISTDS OUTPUT WILL BE AS FOLLOWS (EXAMPLE OF FB & VB)   *   
//*                                                             *   
//* READY                                                       *   
//*   LISTDS 'HLQ.SLQ.TLQ.FLQ'                                  *   
//* HLQ.SLQ.TLQ.FLQ                                             *   
//* --RECFM-LRECL-BLKSIZE-DSORG                                 *   
//*   FBA   133   32718   PS       <<< PICK THIS WITH INCLUDE   *   
//*                                                             *   
//*                                                             *   
//* READY                                                       *   
//*   LISTDS 'HLQ.SLQ.TLQ.FLQ'                                  *   
//* HLQ.SLQ.TLQ.FLQ                                             *   
//* --RECFM-LRECL-BLKSIZE-DSORG                                 *   
//*   VB    76    32760   PS       <<< PICK THIS WITH INCLUDE   *   
//*                                                             *   
//* GENERATE INREC BUILD STATEMENT THAT CAN BE USED TO ADD A    *   
//* SPACE IN THE FIRST POSITION                                 *   
//*                                                             *   
//* INREC BUILD=(X,1,lrecl) << FOR RECFM=F FILE                 *   
//* INREC BUILD=(1,4,X,5)   << FOR RECFM=V FILE                 *   
//***************************************************************   
//STEP0200 EXEC PGM=SORT                                             
//SYSOUT   DD SYSOUT=*                                               
//SORTIN   DD DSN=&&L,DISP=SHR                                       
//SORTOUT  DD DSN=&&S,DISP=(,PASS),SPACE=(TRK,(1,0),RLSE)           
//SYSIN    DD *                                                     
  OPTION COPY,STOPAFT=1,NULLOUT=RC4                                 
  INCLUDE COND=(23,2,CH,EQ,C'PS')                                   
                                                                     
  OUTFIL NULLOFL=RC4,IFOUTLEN=80,                                   
  IFTHEN=(WHEN=(3,1,CH,EQ,C'F'),                                     
          BUILD=(3:C'INREC BUILD=(X,1,',9,6,UFF,M11,LENGTH=5,C')')),
  IFTHEN=(WHEN=(3,1,CH,EQ,C'V'),                                     
          BUILD=(3:C'INREC BUILD=(1,4,X,5)')),                       
  IFTHEN=(WHEN=NONE,BUILD=(C'ERROR BUILDING SYSIN CARDS'))           
//*                                                                 
//***************************************************************
//* USE THE INREC STATEMENT ABOVE TO ADD THE SPACE  AT BEGINNING*
//* USING THE PARM LINES=n WILL ADD A HEADER FOR EVERY n RECORDS*
//***************************************************************
//STEP0300 EXEC PGM=SORT,COND=(4,LE,STEP0200)                     
//SYSOUT   DD SYSOUT=*                                           
//SORTIN   DD DISP=SHR,DSN=&IDSN                                 
//SORTOUT  DD SYSOUT=*                                           
//SYSIN    DD *                                                   
  OPTION COPY                                                     
//         DD DISP=SHR,DSN=&&S                                   
//         DD *                                                   
  OUTFIL REMOVECC,LINES=50,                                       
  HEADER2=(15:'EXAMPLE OF HOW HEADER2 WORKS')                     
//* 
Back to top
View user's profile Send private message Send e-mail Visit poster's website
misi01
Advanced


Joined: 02 Dec 2002
Posts: 629
Topics: 176
Location: Stockholm, Sweden

PostPosted: Fri Feb 02, 2018 11:58 am    Post subject: Reply with quote

You're a star Kolusu.

I'll give it a whirl on Monday. Thanks
_________________
Michael
Back to top
View user's profile Send private message Send e-mail
misi01
Advanced


Joined: 02 Dec 2002
Posts: 629
Topics: 176
Location: Stockholm, Sweden

PostPosted: Mon Feb 05, 2018 2:41 am    Post subject: Reply with quote

Worked a treat. After a little bit of tweaking, this was my default JCL skeleton (the ACTUAL JCL is built using skeletons via a Rexx script, so I already know the DCB's for the input file)
Code:

//SORT    EXEC PGM=SORT                                       
//*
//SYSOUT    DD SYSOUT=*                                       
//SORTIN    DD DISP=SHR,DSNAME=&DSNAME
//SORTOUT   DD DSN=&&S,DISP=(NEW,CATLG,DELETE)                 
//SYSPRINT  DD SYSOUT=*                                       
//SYSIN    DD *                                               
  OPTION COPY                                                 
  INREC BUILD=(X,1,&LRECL)                                         
  OUTFIL REMOVECC,LINES=51,                                   
  HEADER2=(15:'Dummy Header, never shown')                     
//*                                                           
//HC      EXEC PGM=IEBGENER,COND=EVEN               
//*-------------------------------------------------
//* HARDCOPY PRINT                                 
//* PRT will have been set by the user indicating   
//* what they consider their local printer to be   
//*-------------------------------------------------
//SYSUT1    DD DISP=SHR,DSN=&&S                     
//SYSUT2    DD SYSOUT=(F,&ORIENT),DEST=&&PRT
//SYSPRINT  DD DUMMY                               
//SYSIN     DD DUMMY                               


Thanks again. (BTW - I had a bit of a problem using your original example because it assumes the input file is a simple sequential one, mine was a PDS, so the determination of the DCB's was failing on the condition)
_________________
Michael
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


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

PostPosted: Mon Feb 05, 2018 11:30 am    Post subject: Reply with quote

misi01 wrote:
Worked a treat. After a little bit of tweaking, this was my default JCL skeleton (the ACTUAL JCL is built using skeletons via a Rexx script, so I already know the DCB's for the input file)
Thanks again. (BTW - I had a bit of a problem using your original example because it assumes the input file is a simple sequential one, mine was a PDS, so the determination of the DCB's was failing on the condition)


misio1,

It is amazing that you had resort to using a REXX instead of fixing the JCL which is quite trivial. Even if your input is a PDS, you are always processing a single member ( DFSORT cannot process the entire PDS without a member name).

When you provide the member name, it is nothing but a sequential file under the covers.
Code:

// SET IDSN='YOUR PDS NAME(MEMBER NAME)'     


and the only change you need to do is the INCLUDE COND statement

Change this
Code:
 INCLUDE COND=(23,2,CH,EQ,C'PS')

to this (just add PO with SS format)
Code:

INCLUDE COND=(23,2,SS,EQ,C'PS,PO')

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


Joined: 02 Dec 2002
Posts: 629
Topics: 176
Location: Stockholm, Sweden

PostPosted: Sun Feb 11, 2018 4:07 am    Post subject: Reply with quote

It wasn't a case of having to resort to Rexx, it was more a case of tweaking an existing Rexx script. The original script allowed you to edit a PDS member or file and simply enter the command printsa4/printla4 to send it off to a network printer. (Yes, I know there are multiple ways of doing the same thing, but to my mind, it's very simple to be editing a file, realize you'd like to see the results on paper and enter a simple command to achieve this)

The problem started with where I am now. Nobody seems to know what sysout class is needed to achieve portrait or landscape output. The result was the first character being pinched as a control character as well as every 50th line being pinched for something else.

So, the end result was ...... I already had the Rexx to create the JCL via skeletons, I just needed the dfsort instructions to avoid the "unwanted" processing
_________________
Michael
Back to top
View user's profile Send private message Send e-mail
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