I want a JCL to copy specified number of records

In this Mainframe Forum - You can post your queries on JCL, OS/390 JCL, MVS JCL, z/OS JCL, JES2 & JES3

Moderators: Frank Yaeger, DikDude, Moderator Group

Post Reply
sumit_mainframe
Member
Posts: 4
Joined: Thu Jan 21, 2010 11:45 am

I want a JCL to copy specified number of records

Post by sumit_mainframe » Mon Apr 19, 2010 3:42 pm

Hi,

I am having a problem in copying some selected records from 10 different files into a single file.
Below is the discription--

I want to copy records from 10 file ,but each file has different no of records. I want to copy data from only the first line and from
position 27 to 35. The output file should contain records appended from all the files.

The JCL which i have written is working fine for single file, but not for multiple files.


Please help me ASAP.

Thanks,
Sumit

User avatar
dbzTHEdinosauer
Moderator
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Mon Apr 19, 2010 4:40 pm

ASAP is not a nice word, usually given as a command.
if you wanted to be nice, you should have said something like,
this is urgent to me.

would have been helpful to see the job that you have.
depending on what utility you used in the job step,
we could have easily provided you help.

especially, since this is an ASAP kind of thing, you don't want to have us waste your time providing potentially useless suggestions (utilities that you do not have).

if you can do it with one file, suggest that you add 9 additional steps with the disposition of the output file being mod.
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.

sumit_mainframe
Member
Posts: 4
Joined: Thu Jan 21, 2010 11:45 am

Post by sumit_mainframe » Tue Apr 20, 2010 5:48 pm

Hi Dick,

Thanks for reminding me of my mistake.
I didn't mean to use "ASAP" in a commanding way, but anyways i also realise that it was not the right word.

I'll soon provide you the job, so that the right solution is given.


Thanks,
Sumit

sumit_mainframe
Member
Posts: 4
Joined: Thu Jan 21, 2010 11:45 am

Post by sumit_mainframe » Wed Apr 21, 2010 12:06 pm

Hi all,

Below is the job, which i am trying.

//BKPJCL01 JOB 00000000, 'BKP JCL',MSGCLASS=A,CLASS=A,NOTIFY=&SYSUID

//STEP00 EXEC PGM=SORT,REGION=4096K

//SORTIN DD DISP=SHR,DSN=PWSX.SUMIT.TEST01.ABC.TC1

//* DD DISP=SHR,DSN=PWSX.SUMIT.TEST01.ABC.TC2

//* DD DISP=SHR,DSN=PWSX.SUMIT.TEST01.ABC.TC3

//* DD DISP=SHR,DSN=PWSX.SUMIT.TEST01.ABC.TC4

//* DD DISP=SHR,DSN=PWSX.SUMIT.TEST01.ABC.TC5

//* DD DISP=SHR,DSN=PWSX.SUMIT.TEST01.ABC.TC6

//* DD DISP=SHR,DSN=PWSX.SUMIT.TEST01.ABC.TC7

//* DD DISP=SHR,DSN=PWSX.SUMIT.TEST01.ABC.TC8

//* DD DISP=SHR,DSN=PWSX.SUMIT.TEST01.ABC.TC9

//SORTOUT DD DSN=PWSX.KASPAG5.TEST.BKP2,DISP=SHR

//SYSIN DD *

SORT FIELDS=COPY,

STOPAFT=1

OUTREC FIELDS=(1,4,27,3)

//SYSOUT DD SYSOUT=X

//SYSUDUMP DD SYSOUT=X

//SORTLIB DD DSN=SYS1.SORTLIB,DISP=(SHR,KEEP,KEEP)

//SORTWK01 DD UNIT=DISK,SPACE=(6233,(5000,3000),RLSE,,ROUND)

//SORTWK02 DD UNIT=DISK,SPACE=(6233,(5000,3000),RLSE,,ROUND)

//SORTWK03 DD UNIT=DISK,SPACE=(6233,(5000,3000),RLSE,,ROUND)

//SORTWK04 DD UNIT=DISK,SPACE=(6233,(5000,3000),RLSE,,ROUND)


Please provide me the solution.

Thanks,
Sumit

MrSpock
Active Member
Posts: 273
Joined: Wed Jun 27, 2007 5:37 pm

Post by MrSpock » Wed Apr 21, 2010 9:45 pm

There is no way you can do what you want by concatenating the input files together, unless there is something within the files that you can use to determine when you have reached the first record of each file, or unless you insert some sort of control break in between each dataset of the concatenation.

I'd suggest that you use multiple jobs steps with only one file allocated to SORTIN for that step, or assign the files to multiple unique DD names and use ICETOOL or SYNCTOOL (you still haven't suppplied us with the product you use).

User avatar
dbzTHEdinosauer
Moderator
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Wed Apr 21, 2010 9:55 pm

as MrSpock inferred,

I would set-up my sort step as a proc, using symbolics as the SORTIN DSN=...
and use disp=mod for SORTOUT.
and then your JOB would consist of an IEFBR14 to delete the SORTOUT,
and 10 invocations of the proc, using different values for the symbolics each time.

I would also remove the SORTWORK DD statements, as they
are not needed for this JOB
and
as they are resource requirements, may inhibit the JOB from being scheduled to run
until the required resources are available.
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Wed Apr 21, 2010 9:58 pm

sumit,

Is there anything in the first record of each file that identifies it as such (e.g. HDR in positions 1-3)? What is the RECFM and LRECL of each input file?

Can you use MOD for the SORTOUT data set?
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others