JCL to Copy a file in to another file along with the Header



Support for NetApp SyncSort for z/OS, Visual SyncSort, SYNCINIT, SYNCLIST and SYNCTOOL

JCL to Copy a file in to another file along with the Header

Postby siva219734 » Tue Dec 01, 2009 5:32 pm

All,

let us suppose that I have a dataset with XXXX records. Please provide me the JCL using which I can copy the data(XXXX records) in to another Dataset(same record length of source dataset and FIXED dataset) from the source dataset(FIXED dataset) with Header as " Processing date: <Todays date> Number of Records: XXXX "
For e.g.

Source Dataset:
********************************* Top of Data **********************************
12/01/2009 02:06:55 113 00.034 00.010 00.120
12/01/2009 02:21:56 148 00.036 00.010 00.120
12/01/2009 02:36:56 183 00.037 00.010 00.150

Destination dataset after copying should be:
********************************* Top of Data **********************************
Processing date: 12/01/2009 Number of Records: 3
12/01/2009 02:06:55 113 00.034 00.010 00.120
12/01/2009 02:21:56 148 00.036 00.010 00.120
12/01/2009 02:36:56 183 00.037 00.010 00.150

Thanks in advance.
--
No Me.... No Fun......!
Know Me... Know Fun....!
Siva Kumar Reddy
User avatar
siva219734
 
Posts: 11
Joined: Thu Mar 13, 2008 3:34 am
Location: Mumbai
Has thanked: 0 time
Been thanked: 0 time

Re: JCL to Copy a file in to another file along with the Header

Postby Frank Yaeger » Tue Dec 01, 2009 9:10 pm

Here's a DFSORT job that will do what you asked for:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN    DD    *
  OPTION COPY
  OUTFIL REMOVECC,NODETAIL,
    TRAILER1=('CT,''',COUNT=(M10,LENGTH=4),'''',80:X)
/*
//S2 EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=...  input file
//SORTOUT DD DSN=...  output file
//SYSIN    DD    *
 OPTION COPY
 OUTFIL REMOVECC,
   HEADER1=('Processing date:',18:DATE=(MD4/),
     33:'Number of Records:',CT)
/*
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: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times

Re: JCL to Copy a file in to another file along with the Header

Postby siva219734 » Wed Dec 02, 2009 11:43 am

Hi Frank,

Thanks for the details. I will try this out and check.
--
No Me.... No Fun......!
Know Me... Know Fun....!
Siva Kumar Reddy
User avatar
siva219734
 
Posts: 11
Joined: Thu Mar 13, 2008 3:34 am
Location: Mumbai
Has thanked: 0 time
Been thanked: 0 time

Re: JCL to Copy a file in to another file along with the Header

Postby siva219734 » Wed Dec 02, 2009 2:40 pm

Hi Frank,

I had customized above code provided by you and ran the job. But I am getting syntax error shown below:

SYSIN :
OPTION COPY
OUTFIL REMOVECC,
HEADER1=('PROCESSING DATE:',18:DATE=(DM4/),
33:'NUMBER OF RECORDS:',CT1)
DATA DICTIONARY SYMBOLS SUBSTITUTED :
OPTION COPY
OUTFIL REMOVECC,HEADER1=('PROCESSING DATE:',18:DATE=(DM4/),33:'NUMBER OF RECORD
:',CT1)
*
WER268A OUTFIL STATEMENT : SYNTAX ERROR

WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE

Here is the code I am executing:

//S1      EXEC PGM=SORT                                           
//SYSOUT    DD SYSOUT=*                                           
//SORTIN    DD DSN=...Input datset,DISP=SHR     
//SORTOUT   DD DSN=&&S1,UNIT=(SYSDA),SPACE=(TRK,(5,1)),DISP=(,PASS)
//SYSIN     DD *                                                   
  OPTION COPY                                                     
  OUTFIL REMOVECC,NODETAIL,                                       
    TRAILER1=('CT,''',COUNT=(M10,LENGTH=10),'''',80:X)             
/*                                                                 
//*                                                               
//S2      EXEC PGM=ICEMAN                                         
//SYSOUT    DD SYSOUT=*                                           
//SYMNAMES  DD DSN=&&S1,DISP=(OLD,PASS)                           
//SORTIN    DD DSN=...Input datset,DISP=SHR     
//SORTOUT   DD DSN=HLQ.FINAL.OUTPUT.GDG(+1),         
//             DISP=(,CATLG,DELETE),                           
//             RECFM=FB,UNIT=(SYSDA,3),
//             SPACE=(CYL,(5,1),RLSE)                             
//SYSIN     DD *                                   
  OPTION COPY                                       
  OUTFIL REMOVECC,                                 
   HEADER1=('PROCESSING DATE:',18:DATE=(DM4/),     
   33:'NUMBER OF RECORDS:',CT)                     
/*                                                 
--
No Me.... No Fun......!
Know Me... Know Fun....!
Siva Kumar Reddy
User avatar
siva219734
 
Posts: 11
Joined: Thu Mar 13, 2008 3:34 am
Location: Mumbai
Has thanked: 0 time
Been thanked: 0 time

Re: JCL to Copy a file in to another file along with the Header

Postby siva219734 » Wed Dec 02, 2009 2:43 pm

Sorry... Frank.. Corresponding error message for the above code is shown below:

SYSIN :
OPTION COPY
OUTFIL REMOVECC,
HEADER1=('PROCESSING DATE:',18:DATE=(DM4/),
33:'NUMBER OF RECORDS:',CT)
DATA DICTIONARY SYMBOLS SUBSTITUTED :
OPTION COPY
OUTFIL REMOVECC,HEADER1=('PROCESSING DATE:',18:DATE=(DM4/),33:'NUMBER OF RECORD
:',CT)
*

WER268A OUTFIL STATEMENT : SYNTAX ERROR
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE

Moderator Note: The above messages:
WER268A OUTFIL STATEMENT : SYNTAX ERROR
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE

obviously indicate that the product is SYNCSORT, not DFSORT. This topic has been moved to the Syncsort Forum.
--
No Me.... No Fun......!
Know Me... Know Fun....!
Siva Kumar Reddy
User avatar
siva219734
 
Posts: 11
Joined: Thu Mar 13, 2008 3:34 am
Location: Mumbai
Has thanked: 0 time
Been thanked: 0 time

Re: JCL to Copy a file in to another file along with the Header

Postby Alissa Margulies » Wed Dec 02, 2009 10:56 pm

Siva,

I was able to successfully execute your code with no errors. Please forward me your complete and unedited job listing as a text attachment to alissa.margulies@syncsort.com and I would be happy to further assist you.

Regards,
Alissa
Alissa Margulies
Syncsort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Alissa Margulies
Global moderator
 
Posts: 369
Joined: Tue Feb 26, 2008 11:15 pm
Location: USA
Has thanked: 1 time
Been thanked: 3 times

Re: JCL to Copy a file in to another file along with the Header

Postby siva219734 » Thu Dec 03, 2009 12:34 pm

Hi Alissa,

Thanks for your reply. Sent you the details in an email as requested.

Thanks again.
--
No Me.... No Fun......!
Know Me... Know Fun....!
Siva Kumar Reddy
User avatar
siva219734
 
Posts: 11
Joined: Thu Mar 13, 2008 3:34 am
Location: Mumbai
Has thanked: 0 time
Been thanked: 0 time

Re: JCL to Copy a file in to another file along with the Header

Postby Alissa Margulies » Thu Dec 03, 2009 10:20 pm

Siva,

Since your data is variable length, you need to slightly modify the control statements in the first step:

//SYSIN   DD *   
  OPTION COPY                                       
  OUTFIL REMOVECC,NODETAIL,                         
    TRAILER1=('CT,''',COUNT=(M10,LENGTH=10),''''),   
    OUTREC=(5,80),CONVERT                       
/*

Give that a try and let me know if you still encounter any problems.
Alissa Margulies
Syncsort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Alissa Margulies
Global moderator
 
Posts: 369
Joined: Tue Feb 26, 2008 11:15 pm
Location: USA
Has thanked: 1 time
Been thanked: 3 times

Re: JCL to Copy a file in to another file along with the Header

Postby siva219734 » Mon Dec 07, 2009 8:40 pm

Hi Alissa,

Thanks for all your help. It did work!!

Regards,
Siva
--
No Me.... No Fun......!
Know Me... Know Fun....!
Siva Kumar Reddy
User avatar
siva219734
 
Posts: 11
Joined: Thu Mar 13, 2008 3:34 am
Location: Mumbai
Has thanked: 0 time
Been thanked: 0 time


Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post