Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

write file1 from file2 -- EXCLUDING variable

Status
Not open for further replies.

mckarl

Programmer
May 5, 1999
147
GB
i need to be able to write a file from another missing out the filler statements. I know i can move them all, but i am looking for a way to exclude them.<br>
<br>
thankyou for your time<br>
<br>
-karl <p> <br><a href=mailto:mc_karl@yahoo.com>mc_karl@yahoo.com</a><br><a href=karls-stuff.co.uk>my stuff :)) WINProducts & stuff</a><br>- Karl<br>
<br>
- <b> the </b> damn good lookin' one ;)
 
You're asking too much of the old dowager. The best you can do is to use the MOVE CORRESPONDING construct, but that will probably cost typing in other parts of your program. <br><br>COBOL allows you to use exactly the same field names in two different structure heirarchies, as long somewhere above each there are names that are different. If the name that is reused is A, and B includes A in one heirarchy, and C includes A in the other, then you can distinguish which A you mean by saying something like:<br> MOVE A IN B TO A OF C. ('IN' and 'OF' have the same effect.)<br><br>The advantage to this is that you can now say:<br> MOVE CORRESPONDING B TO C.<br>and COBOL will in effect generate a MOVE statement like the one above for each pair of like named fields under B and C. They do not have to appear in the same order, and they do not have to be the same size or type; the usual rules for COBOL moves apply. (You should probably look up the picky details of how this all works if you plan to use it.)<br><br>The application to your problem is that you can use different 01 level names for the two records in your FD's, but make the lower level names the same. Then a MOVE CORRESPONDING will write those MOVE statements for you, skipping any FILLERs in either record.<br><br>You may not have wanted to know about this &quot;solution&quot;, but then, I never claimed that COBOL is pretty.
 
ouch... godda read that one over a few times. YEIKES!<br>
<br>
Thankz bprange. must say though. CoBOL is getting better.<br>
(??) <p> <br><a href=mailto:mc_karl@yahoo.com>mc_karl@yahoo.com</a><br><a href=karls-stuff.co.uk>my stuff :)) WINProducts & stuff</a><br>- Karl<br>
<br>
- <b> the </b> damn good lookin' one ;)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top