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

Records must be in reverse order


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
venkatarao

New User


Joined: 19 Dec 2004
Posts: 23
Location: hyderabad

PostPosted: Mon Jul 04, 2005 10:15 am
Reply with quote

i have two files A, B
contents in A are
abc
xyz
pry like
contents in B are
def
ghi
jkl like
i want to copy these two files records into some another file like c but records must be in reverse order like
conteents in c must be
record abc like cba like how we do that?
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Mon Jul 04, 2005 11:00 am
Reply with quote

If you are looking for a COBOL CODE.......

Code:
      OPEN INPUT INFILE
               OUTPUT OUT FILE.
      PROCESS UNTIL END-INFILE.
      CLOSE INFILE, OUTFILE.

PROCESS.
       READ INFILE INTO INREC AT END SET END-INFILE TO TRUE.
       MOVE INREC(3:1) TO OUTREC(1:1).
       MOVE INREC(2:1) TO OUTREC(2:1).
       MOVE INREC(1:1) TO OUTREC(3:1).
       WRITE OUTFILE FROM OUTREC.
       EXIT.


This is for the string of length of 3.

Regards,

Priyesh.
Back to top
View user's profile Send private message
ideas

New User


Joined: 25 May 2005
Posts: 52
Location: India

PostPosted: Mon Jul 04, 2005 4:26 pm
Reply with quote

1-confirm from frank and team if theres a SORT util which can do this in reverse fashion..
2-via code where I dont need to use the LRECL..may be reading in an array..changing the Subscript by -1 then may be of help..
3-also check, is there a REVERSE func defined in COBOL?

btw where was it asked?
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 -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Rotate partition-logical & physic... DB2 0
Search our Forums:

Back to Top