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
 
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: 6968
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: 6968
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: 2504
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 line 52: Name or string > 250 char... Ashishpanpaliya CLIST & REXX 5 Sat Oct 14, 2017 2:29 am
No new posts How to write Rexx program to size and... sreejeshcs CLIST & REXX 14 Thu Oct 12, 2017 7:26 am
No new posts display the sign only if the value is... useit DFSORT/ICETOOL 3 Wed Oct 04, 2017 5:53 pm
No new posts Binary to display characters Roy Ware SYNCSORT 3 Tue Sep 19, 2017 8:46 pm
No new posts DB2 NULL Values display V S Amarendra Reddy DB2 3 Thu Sep 07, 2017 6:59 pm

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