JCL to copy first 50 records



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

JCL to copy first 50 records

Postby anubhav.1982 » Tue Dec 07, 2010 10:10 pm

Hi

I need a JCL that copies the first 50 records from source file to destination file.

Thnaks for your help

Anubhav
anubhav.1982
 
Posts: 8
Joined: Wed Oct 20, 2010 7:04 pm
Has thanked: 0 time
Been thanked: 0 time

Re: JCL to copy first 50 records

 

Re: JCL to copy first 50 records

Postby Robert Sample » Tue Dec 07, 2010 10:14 pm

Good luck with that -- since JCL does nothing but execute programs, you will have to wait a LONG, LONG, LONG time before the JCL will copy records.

Now, if you had a need to use IDCAMS or SORT to copy records within a job -- that is simplicity and you could read the appropriate manuals yourself to do so.
Robert Sample
Global moderator
 
Posts: 3367
Joined: Sat Dec 19, 2009 8:32 pm
Location: East Dubuque, Illinois
Has thanked: 1 time
Been thanked: 222 times

Re: JCL to copy first 50 records

Postby anubhav.1982 » Tue Dec 07, 2010 10:19 pm

Hey Robert

Copying the records from one file to another is real quick in JCL and I have been doing that for a while that.
I only needed selective copying.


I tried IDCALMS/sort but it does not work.

thnks
Anubhav
anubhav.1982
 
Posts: 8
Joined: Wed Oct 20, 2010 7:04 pm
Has thanked: 0 time
Been thanked: 0 time

Re: JCL to copy first 50 records

Postby Frank Yaeger » Tue Dec 07, 2010 10:39 pm

You can use a DFSORT job like the following:

//S1 EXEC PGM=SORT                                               
//SYSOUT DD SYSOUT=*                                             
//SORTIN DD DSN=...  input file                                                   
//SORTOUT DD DSN=...  output file 
//SYSIN DD *                                                     
  OPTION COPY,STOPAFT=50                                                   


If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

http://www.ibm.com/support/docview.wss? ... g3T7000080
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
User avatar
Frank Yaeger
Global moderator
 
Posts: 1080
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 14 times

Re: JCL to copy first 50 records

Postby Frank Yaeger » Tue Dec 07, 2010 10:40 pm

I tried IDCALMS/sort but it does not work.


This kind of statement is pretty useless as we don't know what you tried exactly or what error you got. In the future, give details so people can help you.
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
User avatar
Frank Yaeger
Global moderator
 
Posts: 1080
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 14 times

Re: JCL to copy first 50 records

Postby anubhav.1982 » Tue Dec 07, 2010 10:46 pm

tHE jcl GAVE AN ERROR

WER224A SORTIN NOT DEFINED
anubhav.1982
 
Posts: 8
Joined: Wed Oct 20, 2010 7:04 pm
Has thanked: 0 time
Been thanked: 0 time

Re: JCL to copy first 50 records

Postby anubhav.1982 » Tue Dec 07, 2010 10:55 pm

I used the fllowing JCl

//CP1 JOB (SB9IC-FSSGEN,PLZ2),'ALMSPL - COPY',
// MSGCLASS=A
/*PROFILE CPU=(5,00),TAPE=2
/*ROUTE PRINT SDSF
/*NOTIFY VQ103
//*
//* COPY SPL FILE
//*
//STEP01 EXEC PGM=SORT
//SYSOUT DD SYSOUT=A
//SYSUT1 DD DSN=SB900.GIPRIC.ALMFTP.DVLP.PRG.DEV.ANUBH4,DISP=SHR
//SYSUT2 DD DSN=SB900.GIPRIC.ALMFTP.DVLP.PRG.DEV.ANUBH411,
// DISP=(NEW,CATLG,DELETE),UNIT=INFOREAL,
// LABEL=EXPDT=60001,SPACE=(CYL,(95,30),RLSE)
//SYSIN DD *
OPTION COPY,STOPAFT=50
**************************** Bottom of Data ************************
anubhav.1982
 
Posts: 8
Joined: Wed Oct 20, 2010 7:04 pm
Has thanked: 0 time
Been thanked: 0 time

Re: JCL to copy first 50 records

Postby Robert Sample » Tue Dec 07, 2010 11:07 pm

I use IDCAMS to copy records all the time:
//STEP1    EXEC PGM=IDCAMS,REGION=6M
//SYSPRINT DD   SYSOUT=*
//DD01     DD   DISP=SHR,DSN=source.data.set
//DD02     DD   DISP=SHR,DSN=target.data.set
//SYSIN    DD   *
  REPRO IFILE(DD01) OFILE(DD02) COUNT(50)
so when you said IDCAMS "did not work" -- what do you mean? Did you get a JCL error? Did you get a system abend? Did you get an IDCAMS error? Did something else happen?

You can even use the SKIP option of REPRO to get IDCAMS to start somewhere other than the first record.
Robert Sample
Global moderator
 
Posts: 3367
Joined: Sat Dec 19, 2009 8:32 pm
Location: East Dubuque, Illinois
Has thanked: 1 time
Been thanked: 222 times

Re: JCL to copy first 50 records

Postby enrico-sorichetti » Tue Dec 07, 2010 11:08 pm

the jcl You used does not follow the guidelines given by Frank!

anyway Frank Yaeger is a DFSORT Developer,
since DFSORT and SYNCSORT are competitor products, do not expect from Frank answers on SYNCOSRT

read the SYNCSORT documentation for the ddnames required/implied/used by SYNCSORT applications
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2643
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 130 times

Re: JCL to copy first 50 records

Postby Frank Yaeger » Tue Dec 07, 2010 11:31 pm

WER224A SORTIN NOT DEFINED


It's not that Sort (syncsort) didn't work - it's that YOU did not have the correct DD statements. SORTIN and SORTOUT are needed - not SYSUT1 and SYSUT2. I guess you didn't notice the difference between your job and mine, or bother to pick up a manual, or pay attention to the error message, or any of a number of other things that would have let you solve the problem yourself. You might want to try harder next time.
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
User avatar
Frank Yaeger
Global moderator
 
Posts: 1080
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 14 times

Next

Return to JCL

 


  • Related topics
    Replies
    Views
    Last post