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
 

 

Display only 80 characters in a line

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
mvmadhavi

New User


Joined: 09 Nov 2006
Posts: 21

PostPosted: Mon Jan 21, 2008 6:50 pm    Post subject: Display only 80 characters in a line
Reply with quote

Hi,

i have a 300 bytes record.

i need to display only 80 bytes in every single line.

pls help
Back to top
View user's profile Send private message

Arunprasad.k

New User


Joined: 04 Jan 2008
Posts: 7
Location: Chennai, India

PostPosted: Mon Jan 21, 2008 6:58 pm    Post subject:
Reply with quote

mvmadhavi,

Use

Code:
DISPLAY 'First 80 Bytes : ' RECORD-OF-300-BYTES(1:80)


Arun.
Back to top
View user's profile Send private message
mvmadhavi

New User


Joined: 09 Nov 2006
Posts: 21

PostPosted: Mon Jan 21, 2008 7:04 pm    Post subject: Reply to: Display only 80 characters in a line
Reply with quote

I want to display all 300 bytes with 80 character in each line


xxxxxxxxxxxxxxxxxxxxxxxx.....80 characters
xxxxxxxxxxxxxxxxxxxxxxxx.....80 characters
xxxxxxxxxxxxxxxxxxxxxxxx......80 characters
so on
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Jan 21, 2008 8:41 pm    Post subject:
Reply with quote

???????????????


DISPLAY 300-CHAR-FIELD(1:80)
DISPLAY 300-CHAR-FIELD(81:160)
DISPLAY 300-CHAR-FIELD(161:240)
DISPLAY 300-CHAR-FIELD(241:59)
Back to top
View user's profile Send private message
the_gautam

Active User


Joined: 05 Jun 2005
Posts: 165
Location: Bangalore

PostPosted: Mon Jan 21, 2008 9:06 pm    Post subject:
Reply with quote

hi mvmadhavi,
you may use the redefine feature as well.

01 RECORD-OF-300-BYTES PIC X(300).

01 REDEFINED-RECORD REDEFINES RECORD-OF-300-BYTES.
05 FIRST-80-BYTES PIC X(80).
05 SECOND-80-BYTES PIC X(80).
05 THIRD-80-BYTES PIC X(80).
05 FOURTH-80-BYTES PIC X(80).

the last one you may have of different size as well. and then you can use these 05 level dataitems as per your requirements.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Jan 21, 2008 10:24 pm    Post subject:
Reply with quote

the_gautam,

your example will not compile because the 4th item will cause REDEFINED-RECORD to be larger than the redefined object.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Mon Jan 21, 2008 10:38 pm    Post subject: Display only 80 characters in a line
Reply with quote

In this example, you don't care about the length of WS-AREA, even if it's less than 80.

Code:

03  WS-AREA  PIC X(300).
03  WS-SUB   PIC 9(008) BINARY.
03  WS-TALLY PIC 9(008) BINARY.
03  WS-RMDR  PIC 9(008) BINARY.

DIVIDE LENGTH OF WS-AREA BY 80 GIVING WS-TALLY REMAINDER WS-RMDR.
MOVE 1 TO WS-SUB.

IF WS-TALLY > ZERO
   PERFORM WS-TALLY TIMES
       DISPLAY WS-AREA (WS-SUB:80)
       ADD 80 TO WS-SUB
   END-PERFORM
END-IF.

IF  WS-RMDR > ZERO
    DISPLAY WS-AREA (WS-SUB:WS-RMDR)
END-IF.


Regards,

Bill
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Display ZEDLMSG without Pressing F1 &... anandgbe CLIST & REXX 8 Thu Dec 15, 2016 4:20 pm
No new posts How to display value of an exit param... lind sh CICS 2 Sun Oct 09, 2016 12:28 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 Insert Lines in JCL with Rexx after a... Willy Jensen CLIST & REXX 3 Tue Aug 30, 2016 4:18 pm
This topic is locked: you cannot edit posts or make replies. Get and display content of an address... lind sh CICS 1 Mon Aug 08, 2016 9:18 am


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