IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

write "sort-in" file name in Trailer record


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
shrinivas_3
Warnings : 1

New User


Joined: 05 Sep 2006
Posts: 34

PostPosted: Tue Sep 12, 2006 12:31 pm
Reply with quote

Hi

I want some method by which i can write the sort-in file name in the trailer record.

suppose i have the below JCL .

Code:

//STEP020 EXEC  SORTD3                             
//SYSOUT    DD  SYSOUT=*                           
//SYSPRINT  DD  SYSOUT=*                           
//SORTIN    DD  DSN=input file      - > assume input has 101 records
//SORTOUT   DD  DSN=output  file
//SYSIN DD  *                                       
  SORT FIELDS=COPY                                 
  OUTFIL FNAMES=SORTOUT,NODETAIL,REMOVECC,         
    TRAILER1=(COUNT)         
/*


the result of this jcl in SORTOUT file is

Code:

      101


MY requirement is that i want the sortout displayed as below

Code:

 input file name  101


I dont want to hardcode sort-in file name in the sort control card.
What i need is that , that INput file name should be generated based on its DDname (i.e SORTIN) .

I.e any file name Against SORTIN dd name should be Printed before the rec count number.

Thanks.
Back to top
View user's profile Send private message
Kevin

Active User


Joined: 25 Aug 2005
Posts: 234

PostPosted: Mon Sep 18, 2006 7:15 pm
Reply with quote

I'd use the SYMNAMES DD to provide the dataset name:

In a prior step, find the dataset name associated to the DD, then create the SYMNAMES dataset with the contents:

DSN,'THE.DATASET.NAME'

Code:

//STEP010  EXEC PGM=somepgm
...
//SORTIN   DD DSN=input file - > assume input has 101 records
//SYMNAMES DD DSN=&&T1,DISP=(,PASS),UNIT=VIO
...


Then, use the symbolic in the SORT step:
Code:

//STEP020  EXEC SORTD3
//SYMNAMES DD DSN=&&T1,DISP=(OLD,DELETE)
//SYSOUT   DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SORTIN   DD DSN=input file - > assume input has 101 records
//SORTOUT  DD DSN=output file
//SYSIN    DD *
  OPTION COPY
  OUTFIL NODETAIL,REMOVECC,
    TRAILER1=(DSN,X,COUNT)
/*
Back to top
View user's profile Send private message
shrinivas_3
Warnings : 1

New User


Joined: 05 Sep 2006
Posts: 34

PostPosted: Tue Sep 19, 2006 12:49 pm
Reply with quote

Thanks Kevin

But when i coded the JCl as per above syntax, it gave me
S013 U0000

I coded the JCL as :

Code:

//STEP010  EXEC PGM=somepgm - (i used one cobol-db2 proc name here, just to run one cobol-db2 sample program , with all other parameters needed to run it )
//SORTIN   DD DSN=input file - > assume input has 101 records
//SYMNAMES DD DSN=&&T1,DISP=(,PASS),UNIT=VIO
...
....
....
...
...


In the same JCL next step i coded as :

Code:

//STEP020  EXEC SORTD3
//SYMNAMES DD DSN=&&T1,DISP=(OLD,DELETE)
//SYSOUT   DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SORTIN   DD DSN=input file (LRECL = 68) - > assume input has 101 records
//SORTOUT  DD DSN=output file (LRECL = 68)
//SYSIN    DD *
  OPTION COPY
  OUTFIL NODETAIL,REMOVECC,
    TRAILER1=(DSN,X,COUNT)
/*

------------------------------------------------------------

One more thing Kelvin , i could not understand the statement

In a prior step, find the dataset name associated to the DD, then create the SYMNAMES dataset with the contents:

DSN,'THE.DATASET.NAME'


------------------------------------------------------------
Next time instead of temporary Data set "T1" i used one already cataloged data set (lrecl=80) for the dd name SYMNAMES

But then it gave me ABENDU0268

TRAILER1=(DSN,X,COUNT)
*
WER268A OUTFIL STATEMENT : SYNTAX ERROR

Also note that we have SYNCSORT utility.

I want to have my sort out output as below:

INPUT FILE NAME 101

Since trailer gives only the count , i need to write input file name just before the count value.

I dont want to Hardcode 'input file name ' in sort control card.
(I am planning to write a procedure later )

Kindly suggest me the solution.

Thanks
Shrinivas
Back to top
View user's profile Send private message
khandagalehh

New User


Joined: 09 Oct 2006
Posts: 1
Location: bangalore

PostPosted: Wed Dec 19, 2007 12:50 pm
Reply with quote

Just try out this jcl step.. this will give u the output as you want. icon_biggrin.gif

Code:

//STEP10 EXEC PGM=SYNCSORT                                         
//SYSOUT  DD SYSOUT=*                                             
//SORTIN  DD DSN=input dataset name
//SORTOUT DD SYSOUT=*                                             
//SYSIN   DD    *                                                 
  OPTION COPY                                                     
  OUTFIL REMOVECC,NODETAIL,                                       
    TRAILER1=(20:'NUMBER OF RECORDS ON FILE:',COUNT=(M10,LENGTH=8))
/*
Back to top
View user's profile Send private message
raak

Active User


Joined: 23 May 2006
Posts: 166
Location: chennai

PostPosted: Wed Dec 19, 2007 7:59 pm
Reply with quote

Quote:
Just try out this jcl step.. this will give u the output as you want.

Code:

//STEP10 EXEC PGM=SYNCSORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=input dataset name
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
OUTFIL REMOVECC,NODETAIL,
TRAILER1=(20:'NUMBER OF RECORDS ON FILE:',COUNT=(M10,LENGTH=8))
/*


What output are u trying to achieve thru this piece of code???
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Dec 19, 2007 9:53 pm
Reply with quote

Hello,

The Syncsort solution posted does not meet the original requirement (which specifies that the input file name (dsn?) be placed in the trailer).

Also, the topic is over a year old. . . .
Back to top
View user's profile Send private message
avaneendra_linga

New User


Joined: 13 Dec 2006
Posts: 73
Location: Hyderabad

PostPosted: Tue Jan 15, 2008 4:54 am
Reply with quote

Hi....

The bestway is using symbolic parameters and genrating the control card...dynamically...Through PARM....

IN PROC....
//STEP010 EXEC PGM=K98....,PARM='CNTRL CARD DAT,&DSN'
//SYSINDD DD DSN=&&DYNCARD
===================
//STEP020 EXEC SORTD3
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SORTIN DD DSN=&DSN - > assume input has 101 records
//SORTOUT DD DSN=output file
//SYSIN DD dsn=&&dyncard
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top