IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Fixed-length vs. variable-length character variables


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Tue Nov 01, 2011 7:48 pm
Reply with quote

On behalf of my team leader (who really should have known the difference), a teachable moment.

The code:
Code:
foo24: proc options (main) reorder;                                   
/********************************************************************/
/*                                                                  */
/* Written Heisei 23.11.01 by Akatsukami-sama                       */
/*                                                                  */
/* Illustrates the difference between fixed-length and              */
/* variable-length character variables.                             */
/*                                                                  */
/********************************************************************/
dcl qual1                          char (60),                         
    qual2                          char (60) var,                     
    work                           char (20),                         
    (i, j, k)                      fixed bin (31);                     
                                                                       
qual1 = 'ABCDEFGHIJ';                                                 
qual2 = 'ABCDEFGHIJ';                                                 
work  = 'ZYXWVUTSRQ';                                                 
i     = 2;                                                             
j     = 4;                                                             
qual1 = qual1 || '.' || substr(work,i,j);                             
qual2 = qual2 || '.' || substr(work,i,j);                             
put skip edit ('qual1 is [', qual1, ']') (a, a, a);                   
put skip edit ('qual2 is [', qual2, ']') (a, a, a);                   
end foo24;                                                             

The output:
Code:
qual1 is [ABCDEFGHIJ                                                  ]       
qual2 is [ABCDEFGHIJ.YXWV]                                                   
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts Store the data for fixed length COBOL Programming 1
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top