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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File question

Status
Not open for further replies.

mdabney

IS-IT--Management
Jul 1, 2002
77
0
0
US
I am trying to self-teach RPG. I have some C++ experience, but I haven't used it in a while. One of the tutorials I'm using says I need to use "the record name for the file". Is that the same thing as the record format? I seem to be stuck on this one item.
 
Yes, if you use DSPFD, you want the Record Format of the file. RedMage1967
IBM Certifed - RPG IV Progammer
 
Thank you. This seems to involve a bit more than C++ and simple CL programs.
 
It can be. What version OS are you running? RedMage1967
IBM Certifed - RPG IV Progammer
 
V5R1- I seem to have loaded both RPG IV and RPG-ILE. The documentation I've read seemed to put the ILE version above the 400 version. I also found articles on converting from 400 to ILE. However, the majority of information I found was on RPG 3, but I couldn't find a conversion tool to 4. I am seeking local clasess, but the community college system here doesn't offer RPG. They do offer C, C+, C++, Java, LotusScript, and VB. My goal is to learn enough to turn queries into reports so that our SysAdmin doesn't spend half the day running queries for everyone. Again, thanks for your help. I seem to have another problem, since I did use the correct record format.
 
You also have the option of coding RPG ILE Free Form "C" Specs. This makes the code look a little bit more like C.

If you want to convert you existing RPG III source code into RPG IV (ILE), there is a system command call cvtrpgsrc Convert RPG Source. This will convert your RPG III to RPG IV. You will have to create new source file with a record length of 100. (RPG III source files have a record lenght of 90, I believe). I hope this helps. RedMage1967
IBM Certifed - RPG IV Progammer
 
I think the source file record length has to be 112. The length of the source line is 100 but the source sequence and change date (both 6 long) take it up to 112. PeteJ
(Contract Code-monkey)

It's amazing how many ways there are to skin a cat
(apologies to the veggies)
 
The source PF doen't have to be length 112, it can be the default of 92 (which gives 80 columns for your code, less 6 bytes each for the date and sequence number). But if you have a 112-byte source file, you can code 20 bytes of comments afer column 80 for fixed-format specifications.
"When once you have tasted flight, you will forever walk the Earth with your eyes turned skyward, for here you have been, and there you will always long to return."

--Leonardo da Vinci

 
I misread the source file length. I've got my QRPGLESRC file set to 112, while QRPGSRC is set to 92. I was looking at the SRCDTA field, not all the fields in the record. My bad. RedMage1967
IBM Certifed - RPG IV Progammer
 
rpg is just like cobol "READ A FILE WRITE A RECORD"

and that makes sense when you think about it. when your reading a file you dont have a clue what the record format is, when you write you better know the format of the record.

this only holds true for extenally defined files. internally defined files you allways use the file name.

You had to uniquely identify the record via a code in a certain position in internally defined files.

I will not go into the exceptions to this rule, remembering this will solve 98 % of the problems
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top