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: 1746
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 SQZ pipe delimited file with 1 column... Rick Silvers DFSORT/ICETOOL 2 Sun Nov 06, 2016 8:11 pm
No new posts Joinkeys operation when key1 and key2... Susanta DFSORT/ICETOOL 5 Wed Nov 02, 2016 5:35 pm
No new posts Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm
This topic is locked: you cannot edit posts or make replies. DSList (3.4) cannot display Chinese c... jacobdng TSO/ISPF 4 Wed Oct 05, 2016 2:51 pm
No new posts Format to pipe delimited with variabl... pshongal SYNCSORT 6 Wed Sep 14, 2016 2:48 pm


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