I would think this would be easiest to do in RPG IV with it's string handling and the %editc and %editw bifs. You could do the same in RPG/400 building the field as you go but it will be a lot more difficult. Scott Mildenberger
I would think this would be easiest to do in RPG IV with it's string handling and the %editc and %editw bifs. You could do the same in RPG/400 building the field as you go but it will be a lot more difficult. Scott Mildenberger
I thought about that. Being Old School, I have never written anything in ILE. I'm not ruling it out though. Let's say I have a character string, 500 bytes long. Can I place an edited number (ie. 123.45- ) anyplace within that string? If I can do that with ILE then my problem is solved and all I need to do is get busy and learn it. I'm not about to attempt such a thing with RPG/400.
Hi Mark. If RPG/IV is not an option at this point, I would create an array. Fill the array with the headings you want, then fill the following elements with the data you want to be displayed. -Mean 1
I thought about that. Being Old School, I have never written anything in ILE. I'm not ruling it out though. Let's say I have a character string, 500 bytes long. Can I place an edited number (ie. 123.45- ) anyplace within that string? If I can do that with ILE then my problem is solved and all I need to do is get busy and learn it. I'm not about to attempt such a thing with RPG/400.
Hi Mark. You can indeed use EVAL to move an edited field to the array. Much like the edit that ASNA gave the S/36 back in the mid-late 80's, this new field is a character string, so it can be handled by a MOVEA or EVAL and SUBSTRING as well. -Mean 1
Yes, the %editc and %editw bif's return the edited version of a number according to the edit code or word. Scott Mildenberger
To solve your problem I would create workfile with all necessary fields: character fields as they are and numeric fields as ‘character image’ Use one field detail line in printer file (you know your report width). This field consists of selected concatenated character field from workfile. Problem is to line up headings and details. To get what I named ‘character image’ run any program to convert numeric field to character or use SQL. SQL statement for conversion should look like: select substr((case when sign(-123.45)=-1 then'-' when sign(-123.45)=1 then' ' end)|| strip((char(integer(123.45))),both,' ')|| strip((char(123.45-integer(123.45))),both,' '),1,7) from dummy Just use your file and fields.
SQL statement could be simplified for V5R1 and later(not sure about previous versions): CHAR command works with signed packed data: SELECT CHAR(-123.45) from dummy creats 7 characters field as '-123.45' DIGITS command omits sign and decimal point and adds leading 0 to converted fields.
Thanks for all the input. It looks like I will end up doing it with ILE. I guess I havent had the need to use ILE before but this looks like as good a time as any to start. Thanks again for the help.
Hi Mark: I had a similar delimma a several years ago (read: RPG 3) where I had to provide the user a list of fields to pick & choose, in my case, they were all currency-type fields. I used an array and a lot of RPG logic to select the values for the desired fields, and store into the array. There was a pre-processing program and some CL code. This process allowed up to 50 or so fields wide, so I allowed for up to 5 printer files, conditioned by external (Ux) indicators and User Open/close of the printer files. This was early 90s, but a green screen spreadsheet format. I can't locate the source at the moment, but if your still interested, e-mail me at info@green-springs.com, and I can try to locate it. /George Pearson Green Springs Software, Inc. www.green-springs.com