here's a cheap & cheesy tool to center data:
the program receives 2 parms. the data to center and the size of the field that contains the data. the program will place the data so it will be centered for the length passed in.
The field "Data" is 500a, the "PgmTitle" field is 50a
example of a call to the program:
the text "Equipment Listing" will be returned from the program in the "Data" field. Just Load your original field using %SUBST.
Code:
Ddata s 500a Dwrkdata s 500a Dlen s 3s 0 Ddatalen s 3s 0 Ddivisor s 3s 0 Dstrpos s 3s 0 C *Entry plist C Parm Data C Parm Len /free if data <> *blanks; Divisor=Len/2; datalen=%len(%Trim(Data)); strpos=datalen/2; strpos=Divisor-strpos; WrkData=Data; Data=*Blanks; if StrPos+DataLen<=%size(Data); %subst(Data:Strpos:DataLen)=%Trim(WrkData); endif; if StrPos+DataLen>%Size(Data); Data=%Trim(WrkData); endif; endif; *INLR=*ON; Return; /end-free
The field "Data" is 500a, the "PgmTitle" field is 50a
example of a call to the program:
Code:
PgmTitle = 'Equipment Listing'; Data = PgmTitle; CenterIt( Data : %Len(PgmTitle)); PgmTitle = %Subst(Data:1:%Len(PgmTitle));
Comment