How to Read Records in Reverse Order in Cobol
Currently Banned
New User
Joined: 06 Aug 2006
Posts: 10
| |
Hello, IN C-language five tin can read contents of a file from the end using pointers. |
Agile Fellow member
Joined: 22 November 2005
Posts: 700
Location: Troy, Michigan USA
| |
I'm going to say No, Reading a file from the back to the front end in COBOL cannot be done within the normal confines of the COBOL language. I believe it should be technically possible, but far exterior acceptability. You would accept to have an in-depth knowledge of the Operating System Control Blocks, and run these using pointers. Then you should be able to set the current record arrow to the last tape and read it. This is NOT something to practice using COBOL. Another way would be to call an assembler subroutine to do the read for you. But, then information technology?s not COBOL, is it. Dave |
Active User
Joined: 07 Aug 2006
Posts: 127
Location: kerala,india
| |
hello rohit This question is asked by me early in the forum merely not much erstwhile entry check out for the replay's from the replays i institute that there is no office in the vs cobol 2 to read file from bottom merely there are options in some cobol compilers . yous can sort the file using some alphabetize field in the file using sort verb to the desending order and make the new file and so read the new file |
New User
Joined: 03 Feb 2006
Posts: 53
Location: Mumbai
| |
Hello You lot can read backwards. intialize central-one. p1. go to p1. Regards Aji Cherian |
New User
Joined: 03 Feb 2006
Posts: 53
Location: Mumbai
| |
How-do-you-do, There is a fault in my previous post. Please encounter the modified lawmaking below. intialize key-1. p1. go to p1. Regards Aji Cherian |
New User
Joined: ten Aug 2006
Posts: 23
| |
Or, put another manner, unless the file is indexed, no you can't exercise information technology. The all-time way to do information technology if the file is not indexed is to use a sort to add a key to the file and then sort it in reverse gild and then merely read it normally. Of form, if it's a small file, you can just read the lot into some kind of table then process information technology that fashion, just this way leads to madness! Showtime reply seems to exist the most common practice. |
Agile Member
Joined: 22 November 2005
Posts: 700
Location: Troy, Michigan Us
| |
Aji, Would you lot be so kind as to enlighten u.s.a. as to where in the COBOL transmission I can read about READ PREVIOUS? I take included a link to the COBOL MANUAL for y'all convenience. Dave |
Super Moderator
Joined: 30 May 2003
Posts: 1592
| |
Hi Aji, The READ PREV is a function of IBM's CICS. While information technology appears that information technology'southward a COBOL office in that it uses COBOL-like syntax the function is only supported when using CICS. I don't know this as a fact just I'm sure CICS uses assembler language to satisfy the asking. |
New User
Joined: 03 February 2006
Posts: 53
Location: Mumbai
| |
hi In that location is a connection, for reading the previous record the correct syntax is Read <file-name> previous tape. regards Aji Cherian |
New User
Joined: 03 February 2006
Posts: 53
Location: Bombay
| |
Hi There is a mistake in my lawmaking one time once again. Sorry. Delight go through the code beneath. intialize central-1. p1. become to p1. Regards Aji Cherian |
Active Member
Joined: 22 November 2005
Posts: 700
Location: Troy, Michigan USA
| |||
Aji Cherian, yous are 1 hard person to convince that there is no ?READ PREVIOUS? in COBOL. Even the COBOL transmission was given to you as a link, merely you persist. Equally Jack said, CICS does have some syntax to support ?READ PREVIOUS? that looks like COBOL, but It?due south not, it?south a CICS command. Or perhaps you are using a NON-IBM compiler that does support it, only this is an IBM VS COBOL II forum, and IBM VS COBOL 2, or whatsoever other IBM COBOL does Non support ?READ PREVIOUS?. Delight read the manual. However, there is one statement you made in your last post that I fully back up.
Dave |
New User
Joined: 03 February 2006
Posts: 53
Location: Mumbai
Agile Member
Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan United states of america
| |||
Well Aji, I gave you lot the benifit of the doubt and idea that at that place might be undocumented options, so I compiled a pocket-size program.
Dave |
Active User
Joined: 08 Dec 2005
Posts: 127
Location: rochester
| |
in cobol we can read previous the file should be an indexed file (i.e ksds-vsam) normal sequential file we cant. |
Active Fellow member
Joined: 22 November 2005
Posts: 700
Location: Troy, Michigan USA
| |
raghunathns, If you await at the example given above, you volition detect that there is a 'Apartment' file and an 'INDEXED' file given. The compiler seems to not similar the READ <file> PREVIOUS for either of them. I submit the same request to yous as to Aji, show me in the IBM COBOL Manual where the 'READ <file> PREVIOUS RECORD' can be plant. Not by the proof that Aji gave for 'READ <file> PREVIOUS' existence valid by showing my where information technology is non in the manual. I have included a link to the COBOL MANUAL for you convenience also.. Dave |
Active User
Joined: 08 Dec 2005
Posts: 127
Location: rochester
Agile Member
Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan United states
| |
raghunathns, I'll requite you fractional credit for your post as I over-generalized when I spoke of IBM COBOL. You showed me where ?READ PREVIOUS Tape? is a valid IBM Extension in the COBOL/VSE manual. Just, information technology is not valid in VS COBOL 2, Enterprise COBOL, and this is not a COBOL/VSE forum. You did a good chore in pointing this out, I?ll respond to this type of post more accurately next fourth dimension. Dave |
Source: https://ibmmainframes.com/about13283.html
0 Response to "How to Read Records in Reverse Order in Cobol"
Post a Comment