PL/I

PL/I

PL/I

 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
    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
    Frank_O_Myers@IBM


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

    Posted Sat April 20, 2013 06:21 AM

    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.

    Robin400


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

    Posted Wed May 08, 2013 12:32 PM

    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

     

    FF1352


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

    Posted Mon May 27, 2013 10:03 PM

    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.

    Robin400