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
 

 

Records must be in reverse order

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
View previous topic :: :: View next topic  
Author Message
venkatarao

New User


Joined: 19 Dec 2004
Posts: 24
Location: hyderabad

PostPosted: Mon Jul 04, 2005 10:15 am    Post subject: Records must be in reverse order
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: 1452
Location: Chicago, IL

PostPosted: Mon Jul 04, 2005 11:00 am    Post subject: Re: cobol
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: 53
Location: India

PostPosted: Mon Jul 04, 2005 4:26 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Order BY AND Index Nileshkul DB2 2 Sat Dec 31, 2016 6:33 pm
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm


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