|
View previous topic :: View next topic
|
| Author |
Message |
Vinodc
New User

Joined: 01 Dec 2005 Posts: 33 Location: Prague
|
|
|
|
Hi,
Need a small help. I need to add a dummy record to a VSAM file using DFSORT.
The file is VSAM fixed length KSDS with length 425. The file is created in a job and in next step a program uses that file in IO mode. But as the file is empty, the program abends. So I wanted to add a dummy record to the file.
The record should be -
000DUMMY-HEADER0000000
I tried using REPROing this record using instream data, but job abended because the job uses PROC and instream data is not allowed in PROCS.
Please let me know how this can be acheived through DFSORT. |
|
| Back to top |
|
 |
BruceC
New User
Joined: 14 Mar 2006 Posts: 6 Location: Los Angeles
|
|
|
|
Here is one way. I tested it with a sequential dataset but SORT can load a new KSDS cluster.
YOUR.JCL.LIB(INITKSDS) contains overrides:
| Code: |
//TESTINIT (JOBCARD...)
//*
// JCLLIB ORDER=(YOUR.TEST.PROCLIB)
//*
//INIT001 EXEC VINODC,
// OUT1='*'
//*
//* Override SORTIN to load initial data
//STEP010.SORTIN DD *
000DUMMY-HEADER0000000
//*
//STEP010.SYSIN DD *
OPTION COPY
//*
//STEP020.SYSIN DD *
OPTION COPY
OUTREC FIELDS=(1,22,403X)
//*
//STEP030.SYSIN DD *
OPTION COPY
//*
|
YOUR.TEST.PROCLIB(VINODC) contains:
| Code: |
//VINODC PROC
//*
//* Create an initialization record and load it to a new KSDS cluster
//*------------------------------------------------------------------*
//* Create initialization data *
//*------------------------------------------------------------------*
//STEP010 EXEC PGM=SORT,COND=(4,LT)
//SYSOUT DD SYSOUT=&OUT1
//SYSPRINT DD SYSOUT=&OUT1
//SORTIN DD DUMMY
//SORTOUT DD DSN=&&DUMMY1,DISP=(NEW,PASS),
// UNIT=SYSDA,SPACE=(TRK,(1,1),RLSE),
// RECFM=F,LRECL=22
//SYSIN DD DUMMY
//*
//*------------------------------------------------------------------*
//* Pad initialization record to correct length *
//*------------------------------------------------------------------*
//STEP020 EXEC PGM=SORT,COND=(4,LT)
//SYSOUT DD SYSOUT=&OUT1
//SYSPRINT DD SYSOUT=&OUT1
//SORTIN DD DSN=&&DUMMY1,DISP=(OLD,PASS)
//SORTOUT DD DSN=&&DUMMY2,DISP=(NEW,PASS),
// UNIT=SYSDA,SPACE=(TRK,(1,1),RLSE),
// RECFM=FB,LRECL=425
//SYSIN DD DUMMY
//*
//*--------------------------------------------------------------------*
//* Drop test file, a sequential file in this case
//*--------------------------------------------------------------------*
//STEP030R EXEC PGM=IEFBR14
//DD01 DD DSN=LAPR.LABTC.TESTDSN,
// DISP=(MOD,DELETE,DELETE),
// UNIT=SYSDA,SPACE=(TRK,1),
// RECFM=FB,LRECL=425
//*--------------------------------------------------------------------*
//* Initialize the dataset
//*--------------------------------------------------------------------*
//STEP030 EXEC PGM=SORT,COND=(4,LT)
//SYSOUT DD SYSOUT=&OUT1
//SYSPRINT DD SYSOUT=&OUT1
//*
//SORTIN DD DSN=&&DUMMY2,DISP=(OLD,PASS)
//SORTOUT DD DSN=LAPR.LABTC.TESTDSN,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,
// SPACE=(TRK,(01,01),RLSE),RECFM=FB,LRECL=425
//*
//SYSIN DD DUMMY
//*
|
|
|
| Back to top |
|
 |
martin9
Active User

Joined: 01 Mar 2006 Posts: 290 Location: Basel, Switzerland
|
|
|
|
hy Vinodc,
note:
if you have a KSDS defined,
the index part is not physically present.
You must insert first a dummy record,
for that index part is created, after
you can delete this dummy record,
but the index part remains existing,
even it is empty.
this is why your program abends.
martin9 |
|
| Back to top |
|
 |
Vinodc
New User

Joined: 01 Dec 2005 Posts: 33 Location: Prague
|
|
|
|
Hi BruceC,
Thanks so much for your response. Your way uses the instream data, though through override from JCL. But , my limitation is I cant use it as it cant be used in PROC and I dont want to give override in JCL.
Hi martin9,
Thanks for explaining the cause of abend. But problem still remains to add the dummy record.
Isnt there any way to insert the dummy record through SORT parameters (Like the way it is used to insert header in reports using OUTFIL HEADER1
)? |
|
| Back to top |
|
 |
martin9
Active User

Joined: 01 Mar 2006 Posts: 290 Location: Basel, Switzerland
|
|
|
|
hy Vinodc,
try to use IDCAMS this is the better utility to do it.
therefore create any sequential dataset with the same lrecl as the vsam cluster. make a repro with this dataset (which has only one string).
note: the seq. dataset should be recfm=vb...
martin9 |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|