× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Bob,
The description was vague lol.  But yes I'm trying to create the DDS using 
a program so I'm building the COLHDG line and writing it out to the source 
file/member, the colhdg is being built using the description from another 
file.  What I was trying to do is make it neat like you said with three 
line headings.

James,
That looks exactly like what I was trying to do.  However I don't have the 
patience to do it.  I've just come up with this code to make the column 
heading two lines if necessary, otherwise just write it out.

 
*-------------------------------------------------------------------------------
 * WRITE_DDS - Subroutine to determine column headings and write them out  
 
 
*-------------------------------------------------------------------------------
c     Write_Dds     BegSr  
c                   Eval      Col_Hdg_1 = *Blanks  
c                   Eval      Col_Hdg_2 = *Blanks  
 * If the description is greater than the 20 allowed for COLHDG, split it. 
 
c                   If        %Len(%Trim(Field_Desc)) <= 20  
c                   Eval      Col_Hdg_1 = 'COLHDG(''' + %Trim(Field_Desc) 
+ 
c                             ''')'  
c                   Except    CasRem1  
c                   Else  
c                   Eval      Col_Hdg_1 = 'COLHDG(''' + 
%Subst(Field_Desc:1: 
c                             :17) + ''' -'  
c                   Except    CasRem1  
c                   Eval      Col_Hdg_2 = '''' +  
c                             %Trim(%Subst(Field_Desc:18:10)) +  
c                             ''')'  
c                   Except    CasRem2  
c                   EndIf  
c                   EndSr  

o          eadd         CasRem1 
o                       LineChr             12 
o                                           18 'A' 
o                       Field_Name          36 
o                                           41 'R' 
o                       Col_Hdg_1           86 
o          eadd         CasRem2 
o                       LineChr             12 
o                                           18 'A' 
o                       Col_Hdg_2           76 

Something else I learned during this little project.  Never say "Yes we 
can do that" when you really mean "man that's a load of work, do I want to 
do it" lol.



Ron Power
Programmer
Information Services
City Of St. John's, NL
P.O. Box 908
St. John's, NL
A1C 5M2
Tel: 709-576-8132
Email: rpower@xxxxxxxxxx
Website: http://www.stjohns.ca/
___________________________________________________________________________
Success is going from failure to failure without a loss of enthusiasm. - 
Sir Winston Churchill

Bob Wrote:
I don't have a clue what you're asking for but...
If you generate the DDS, rather than use the TEXT keyword, use the COLHDG
keyword. That way you can separate the title into three parts like this:

  A        MyField       3A     COLHDG('Poor' 'Flow/Grade' 'Y')

Of course, you probably mean that your data is "POOR Flow/Grade" and you
want to parse that value and then put another field's content underneath 
it.
If so, then forget the COLHDG thing and write a simple parse that 
paginates
the content of the field into the right size chunks.
-Bob


James Wrote:
Actually, what you need is technically called (at least in the world of
compiler construction) a "scanner," not a "parser." And it seems to me
that the path of least resistance is to do something like:

1. Determine the width of the field.
2. Let W = the minimum of the field width or 20 characters
3. Let Q$ = the field description
4. Find the last space in Q$ before or at W+1
5. Let H1 = the portion of Q$ before that space
6. Let Q$ = the portion of Q$ after that space
7. Find the last space in Q$ before or at W+1
8. Let H2 = the portion of Q$ before that space
9. Let H3 = the portion of Q$ after that space.

If H3 is more than W characters wide, or no space is found before W+2,
then add 1 to W, and go back to #3

If you are unable to find a space before W > 20, simply split the field
into 2 or 3 more-or-less equal parts.

That's just a rough sketch, and RPG isn't exactly the best language to
implement it in, but it should do the job.

--
JHHL


--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.




This OutBound email has been scanned for Viruses

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.