View previous topic :: View next topic
|
Author |
Message |
raak
Active User
Joined: 23 May 2006 Posts: 166 Location: chennai
|
|
|
|
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 |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
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 |
|
|
raak
Active User
Joined: 23 May 2006 Posts: 166 Location: chennai
|
|
|
|
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 |
|
|
sril.krishy
Active User
Joined: 30 Jul 2005 Posts: 183 Location: hyderabad
|
|
|
|
Hi,
Put your data in a file and use that one insted of Instrem data.
Thank you
Krishy |
|
Back to top |
|
|
raak
Active User
Joined: 23 May 2006 Posts: 166 Location: chennai
|
|
|
|
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 |
|
|
sril.krishy
Active User
Joined: 30 Jul 2005 Posts: 183 Location: hyderabad
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
raak,
What is the RECFM and LRECL of your file? |
|
Back to top |
|
|
raak
Active User
Joined: 23 May 2006 Posts: 166 Location: chennai
|
|
|
|
LRECL is 80 and RECFM is FB. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
raak
Active User
Joined: 23 May 2006 Posts: 166 Location: chennai
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
sril.krishy
Active User
Joined: 30 Jul 2005 Posts: 183 Location: hyderabad
|
|
|
|
Hi Frank,
Thank you for providing a new learing !
Thanks
Krishy |
|
Back to top |
|
|
|