I want to add five blank spaces to this Error-line variable just before I print to a file or display to screen. I also might need to add five non-spaces characters.

Questions: How to add five blank spaces to the ERROR-LINE variable?

01 ERROR-LINE.                                   
   05 E-JOBNAME.                                 
      10 E-NAME         PIC X(5) VALUE 'FALSE'.  
      10 E-NUM          PIC X(5) VALUE 'FALSE'.  
   10 E-FILL1           PIC X(5) VALUE 'FALSE'.  
   05 E-TRIG-PROV-FROM  PIC X(5) VALUE 'FALSE'.  
   05 E-FILL2           PIC X(5) VALUE 'FALSE'.  
   05 E-TRIG-PROV-THRU  PIC X(5) VALUE 'FALSE'.  
   05 E-FILL3           PIC X(5) VALUE 'FALSE'.  
   05 E-TRIG-TAXONOMY   PIC X(5) VALUE 'FALSE'.  
   05 E-FILL4           PIC X(5) VALUE 'FALSE'.  
有帮助吗?

解决方案

They ways are legion, but I'll stick to a few with data-defintions:

01 ERROR-LINE-FOR-OUTPUT.
  03 FILLER             PIC X(5) VALUE SPACE.                                   
  03 ERROR-LINE.                                   
   05 E-JOBNAME.                                 
      10 E-NAME         PIC X(5) VALUE 'FALSE'.  
      10 E-NUM          PIC X(5) VALUE 'FALSE'.  
      10 E-FILL1        PIC X(5) VALUE 'FALSE'.  
   05 E-TRIG-PROV-FROM  PIC X(5) VALUE 'FALSE'.  
   05 E-FILL2           PIC X(5) VALUE 'FALSE'.  
   05 E-TRIG-PROV-THRU  PIC X(5) VALUE 'FALSE'.  
   05 E-FILL3           PIC X(5) VALUE 'FALSE'.  
   05 E-TRIG-TAXONOMY   PIC X(5) VALUE 'FALSE'.  
   05 E-FILL4           PIC X(5) VALUE 'FALSE'. 

(the 03-level is just so I don't have to change everything, but you can)

01 ERROR-LINE-FOR-OUTPUT.
   05 FILLER             PIC X(5) VALUE SPACE.                                   
   05 ERROR-LINE-FROM-SOURCE 
                        PIC X(45).

MOVE ERROR-LINE         TO ERROR-LINE-FROM-SOURCE

You mention that you may also need a non-space value. The thing to watch is to ensure that you don't "leave a value behind" so it hits the next record.

On the FILLER, you can set two 88s:

88 make-it-descriptive VALUE SPACE.
88 make-it-descriptive-also VALUE "otherthanspace".

Then SET one or the other in an IF/ELSE/END-IF.

You can of course give the FILLER a name (descriptive) and MOVE another data-name (with again a good name) to it.

Get the code to tell the story. Get data-definitions to do work (keeps the PROCEDURE simple).

Keep it simple, easy to understand, easy to maintain.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top