Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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: 1753
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 Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm
No new posts Writing on to GSAM variable length rohanthengal JCL & VSAM 6 Fri Mar 03, 2017 7:46 pm
No new posts the use of 'B3'x character in a panel Pedro TSO/ISPF 1 Thu Feb 16, 2017 3:09 am
No new posts Count Trailing Spaces in variable str... Virendra Shambharkar SYNCSORT 10 Thu Feb 02, 2017 12:23 pm
No new posts DB2 9.1.0 not move values to Host-Var... Miguel Fernandez DB2 8 Wed Jan 25, 2017 8:24 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us