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

inserting record in to an empty file using sort


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
raak

Active User


Joined: 23 May 2006
Posts: 166
Location: chennai

PostPosted: Fri Aug 18, 2006 10:46 am
Reply with quote

hi

this is my query.. i have aa empty flat file in to which i want a single record to be inserted. this record is say XXXXX.

i tried the following in my sort card

SORT FIELDS=COPY
OUTFIL OUTREC=(C'XXXXX')

my sortin and sortout will be the same flat file to which i want this record to be inserted.
i tried the above method, but its not working..

can anyone suggest me how to do this ?


thanks in advance
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Fri Aug 18, 2006 11:14 am
Reply with quote

Hi,

OUTREC is useful for reformatting the input record. Since your sortin (input) file is empty, I feel 'outil outrec' is useless.

Put your record as INSTREAM data to SORTIN like below -

//sortin dd *
your record
/*
//sortout dd dsn=your flat file......

Correct me, if Im wrong.

Thanks,
Murali Mohan K
Back to top
View user's profile Send private message
raak

Active User


Joined: 23 May 2006
Posts: 166
Location: chennai

PostPosted: Fri Aug 18, 2006 11:28 am
Reply with quote

HI murali

what you said is correct.. u can pass the data as instream.. but this is not allowable according to the coding standards followed in our shop.. that is why i wanted a sort card to do this..


any suggestions anyone....................
Back to top
View user's profile Send private message
sril.krishy

Active User


Joined: 30 Jul 2005
Posts: 183
Location: hyderabad

PostPosted: Fri Aug 18, 2006 12:44 pm
Reply with quote

Hi,
Put your data in a file and use that one insted of Instrem data.

Thank you
Krishy
Back to top
View user's profile Send private message
raak

Active User


Joined: 23 May 2006
Posts: 166
Location: chennai

PostPosted: Fri Aug 18, 2006 1:03 pm
Reply with quote

no sir

i want the data to be written using a sort card only...
is there any option in sort card to do that... thatz my question
Back to top
View user's profile Send private message
sril.krishy

Active User


Joined: 30 Jul 2005
Posts: 183
Location: hyderabad

PostPosted: Fri Aug 18, 2006 1:45 pm
Reply with quote

I believe it is not possible to copy a record(s) as you are expecting thru SORT.Either you need to use the instream data or you need to have the data into a file to insert the record(s).

Thank you
Krishy
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Aug 18, 2006 10:05 pm
Reply with quote

raak,

What is the RECFM and LRECL of your file?
Back to top
View user's profile Send private message
raak

Active User


Joined: 23 May 2006
Posts: 166
Location: chennai

PostPosted: Mon Aug 21, 2006 11:17 am
Reply with quote

LRECL is 80 and RECFM is FB.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Mon Aug 21, 2006 8:34 pm
Reply with quote

raak,

Here's a DFSORT job that will do what I think you're asking for:

Code:

//S1    EXEC  PGM=ICEMAN                             
//SYSOUT    DD  SYSOUT=*                             
//SORTIN DD DSN=Y897797.MURAL2.DS,DISP=SHR           
//SORTOUT DD DSN=Y897797.MURAL2.DS,DISP=OLD         
//SYSIN    DD    *                                   
  SORT FIELDS=(1,1,BI,A)                             
  OUTFIL REMOVECC,NODETAIL,                         
     TRAILER1=(C'XXXXX')         
/*                   
Back to top
View user's profile Send private message
raak

Active User


Joined: 23 May 2006
Posts: 166
Location: chennai

PostPosted: Tue Aug 22, 2006 5:39 pm
Reply with quote

thanx ...its working fine..

anyway i found out one more method.. this is also working...

SORT FIELDS=COPY
OUTFIL HEADER1=(C'XXXX',76X),REMOVECC


is there any problem in using this one ?
anyway thanx for the helping hand sir....
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Aug 22, 2006 7:42 pm
Reply with quote

You may actually run into problems using COPY rather than SORT when you have the same data set for input and output. With SORT, the input and output are NOT open at the same time so problems won't occur. With COPY the input and output are open at the same time so problems can occur. For that reason, you really should use SORT rather than COPY when you have the same data set for input and output, and that's why I used a SORT statement rather than a COPY statement.

Since your file is initially empty, you can probably get away with using COPY, but I'd still suggest using SORT when you have the same data set for input and output as it's a good habit to get into.

Whether you use HEADER or TRAILER to insert the record doesn't matter.
Back to top
View user's profile Send private message
sril.krishy

Active User


Joined: 30 Jul 2005
Posts: 183
Location: hyderabad

PostPosted: Tue Aug 22, 2006 11:54 pm
Reply with quote

Hi Frank,
Thank you for providing a new learing !

Thanks
Krishy
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 -> DFSORT/ICETOOL

 


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