PL/I for AIX

 View Only
Expand all | Collapse all

Can PL/I format strings or edit descriptions be stored externally?

  • 1.  Can PL/I format strings or edit descriptions be stored externally?

    Posted Thu April 11, 2013 05:03 PM

    Originally posted by: Frank_O_Myers@IBM


    Hi,
     
    Is there a way to store and use format strings for messages externally (in a file) and then use them in a PUT EDIT statement?
    As can be done with the "C fprintf()" format string?
     
     Mit freundlichen Grüßen / With kindest regards
     
    Frank


  • 2.  Re: Can PL/I format strings or edit descriptions be stored externally?

    Posted Sat April 20, 2013 06:21 AM

    Originally posted by: Robin400


    As far as I know, you cannot. There is a good reason for this.

    However, because PL/I provides the means to give a format specification

    in which the field width, repeat factors, etc,

    are provided at run time, you have pretty much the same facility.



  • 3.  Re: Can PL/I format strings or edit descriptions be stored externally?

    Posted Wed May 08, 2013 12:32 PM

    Originally posted by: FF1352


    Hi

    Yes i think you can do this by using preprocessor features
    you can define your different formats in preprocessor variables like this"


    %dcl     (format1, format2,format3)   char;

    %format1 = '(a(5),x(2),2 f(8),x(1),a(20))' ;    
    %format2 = '(f(3),f(12))' ;
    %format3 = '(f(7,2),a(5),x(1),f(6))';

    and then later in your program do like this:


    put skip edit(str1,ix1,ix2,str2) format1 ;

    put skip edit(ix3,ix4) format2 ;

    put skip edit(flt1,str3,ix4) format3 ;




    and when you compile your program you can see in your Listing that format1,2,3 is changed with that formats that you define with
    preprocessor variables.

    and you can write all your favourite formats in a file and add this file in a Maclib with a name for example "formats" and then
    use this in your program

    %include formats;


    i hope this be usefull for you

    thanks

     



  • 4.  Re: Can PL/I format strings or edit descriptions be stored externally?

    Posted Mon May 27, 2013 10:03 PM

    Originally posted by: Robin400


    That doesn't provide any additional facility than coding the format in the program,

    and certainly doesn't provide the ability to change the format specification at run-time.

    The method I previously suggested in this thread permits format specifications to be changed

    at run time.

     

    In addition to the above, a run-time picture specification can be used

    (obtained from any input file) via the EDIT built-in function.