Joined: 02 Dec 2002 Posts: 629 Topics: 176 Location: Stockholm, Sweden
Posted: Thu Feb 01, 2018 11:45 am Post subject: Insert one blank line in output file
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.
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Thu Feb 01, 2018 12:40 pm Post subject:
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
Joined: 02 Dec 2002 Posts: 629 Topics: 176 Location: Stockholm, Sweden
Posted: Fri Feb 02, 2018 1:50 am Post subject:
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
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
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Fri Feb 02, 2018 11:30 am Post subject:
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
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')
//*
Joined: 02 Dec 2002 Posts: 629 Topics: 176 Location: Stockholm, Sweden
Posted: Mon Feb 05, 2018 2:41 am Post subject:
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
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Mon Feb 05, 2018 11:30 am Post subject:
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
Joined: 02 Dec 2002 Posts: 629 Topics: 176 Location: Stockholm, Sweden
Posted: Sun Feb 11, 2018 4:07 am Post subject:
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
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