Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Fixed-length vs. variable-length character variables

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
View previous topic :: :: View next topic  
Author Message
Akatsukami

Global Moderator


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

PostPosted: Tue Nov 01, 2011 7:48 pm    Post subject: Fixed-length vs. variable-length character variables
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    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Moving values to a variable of copybo... Vignesh Sid COBOL Programming 6 Wed Sep 06, 2017 1:04 pm
This topic is locked: you cannot edit posts or make replies. Selecting two copybooks of different ... Vignesh Sid COBOL Programming 8 Tue Sep 05, 2017 7:28 pm
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts Can we limit length in concatenation ... balaji81_k DB2 7 Tue Aug 22, 2017 2:50 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us