Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

inserting record in to an empty file using sort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: inserting record in to an empty file using sort
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: 1439
Location: Bangalore,India

PostPosted: Fri Aug 18, 2006 11:14 am    Post subject: Re: inserting record in to an empty file using sort
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    Post subject: Re: inserting record in to an empty file using sort
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: 182
Location: hyderabad

PostPosted: Fri Aug 18, 2006 12:44 pm    Post subject:
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    Post subject:
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: 182
Location: hyderabad

PostPosted: Fri Aug 18, 2006 1:45 pm    Post subject:
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 Moderator


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

PostPosted: Fri Aug 18, 2006 10:05 pm    Post subject:
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    Post subject:
Reply with quote

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

DFSORT Moderator


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

PostPosted: Mon Aug 21, 2006 8:34 pm    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Tue Aug 22, 2006 7:42 pm    Post subject:
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: 182
Location: hyderabad

PostPosted: Tue Aug 22, 2006 11:54 pm    Post subject: Re: inserting record in to an empty file using sort
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 2 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 4 Fri Mar 24, 2017 11:51 am
No new posts Record Not found in AlX but record re... mukun264 COBOL Programming 7 Fri Mar 24, 2017 9:28 am
No new posts Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us