MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Wrapping texts dynamically in Cobol Reporting

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
raj_m
Beginner


Joined: 24 May 2005
Posts: 5
Topics: 2

PostPosted: Tue May 24, 2005 9:19 pm    Post subject: Wrapping texts dynamically in Cobol Reporting Reply with quote

Hi ALL,
I'm not an expert in cobol report writing. I have a specific requirement from the users which goes as below.

I have to print the following detail line of the report.
the length of the report line is 80 bytes.( first 10 bytes and last 5 bytes - always spaces)

" TODAY WE RECEIVED A DEPOSIT FROM YOU IN THE AMOUNT OF '
$$,$$$,$$$,$$$,$$9.99, WITH $$,$$$,$$$,$$$,$$9.99 IN CASH. PLEASE BE ASSURED '
THIS WAS DEPOSITED INTO YOUR ACCOUNT "


I am dynamically populating both the amount fields. Based on the amount field, the leading spaces before the $ sign should be truncated. I am able to do this using the string function.
But the task is how do I wrap all the text after the amont fields.

in effect what i need is
if the amt 1 is $99.99 and amt2 is $999.99 then my detail line should read

" TODAY WE RECEIVED A DEPOSIT FROM YOU IN THE AMOUNT OF '
$99.99, WITH $999.99 IN CASH. PLEASE BE ASSURED THIS WAS DEPOSITED INTO '
YOUR ACCOUNT "

if the amt1 is $1,000,000,000,000.00 and amt2 is $1,000,000,000,000.00 then my detail line should read

" TODAY WE RECEIVED A DEPOSIT FROM YOU IN THE AMOUNT OF '
$1,000,000,000,000.00, WITH $1,000,000,000,000.00 IN CASH. PLEASE BE ASSURED '
THIS WAS DEPOSITED INTO YOUR ACCOUNT "

Can anyone suggest me how to come up with a logic to accomplish this?

Thanks
Raj
Back to top
View user's profile Send private message
acevedo
Beginner


Joined: 03 Dec 2002
Posts: 127
Topics: 0
Location: Europe

PostPosted: Wed May 25, 2005 9:25 am    Post subject: Reply with quote

this could be one approach:

Count the leading spaces of the field wheare you have the amount edited:
inspect YOUREDITEDAMOUNT tallying WS-FROM for leading spaces

WS-TO = Length YOUREDITEDAMOUNT - WS-FROM

and then use the initial/end to wrap it using a string sentence:

string
' TODAY WE RECEIVED A DEPOSIT FROM YOU IN THE AMOUNT OF '
YOUREDITEDAMOUNT (WS-FROM:WS-TO)
' ,WITH '
----------SAME WITH AMOUNT2-------------
' IN CASH.PLEASE BE ASSURED THIS WAS DEPOSITED INTO '
' YOUR ACCOUNT'
delimited by size into YOURTEXT
end-string

I've written from scratch, take a look at the manuals.
HTH
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Wed May 25, 2005 9:30 am    Post subject: Reply with quote

Raj,

when you use STRING statement , you will also get the length of the total string using the pointer parm.

ex:
Code:

01 W-MSG1               PIC X(54) VALUE                   
  'TODAY WE RECEIVED A DEPOSIT FROM YOU IN THE AMOUNT OF'.
01 W-MSG2               PIC X(27) VALUE                   
  'IN CASH. PLEASE BE ASSURED'.                           
01 W-MSG3               PIC X(37) VALUE                   
  'THIS WAS DEPOSITED INTO YOUR ACCOUNT'.                 

01 W-DYNAM-TXT.                                   
   05 W-TXT-LENGTH         PIC S9(4) COMP.       
   05 W-TOT-TXT            PIC X(160) VALUE SPACE.

STRING ' '                    DELIMITED BY SIZE     
     W-AMT                    DELIMITED BY SPACE     
     ' WITH '                 DELIMITED BY SIZE     
     W-CASH                   DELIMITED BY SPACE     
     ' '                      DELIMITED BY SIZE     
     W-MSG2                   DELIMITED BY SIZE     
     W-MSG3                   DELIMITED BY SIZE     
     QUOTE                    DELIMITED BY SIZE     
  INTO W-TOT-TXT                                     
  POINTER W-TXT-LENGTH                               
END-STRING.                                         


Now W-txt-length will have the total length of the string.

You can check it and see if it is greater than 80 , then split the message into the next line.

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Bithead
Advanced


Joined: 03 Jan 2003
Posts: 550
Topics: 23
Location: Michigan, USA

PostPosted: Wed May 25, 2005 9:37 am    Post subject: Reply with quote

I usually build the line in a large working storage field then I set my pointer to the maximum length of the report field plus 1 (in your case 81). I then work back until I find a space (you may also want to check for the period). I then move the first part into line 1 and the rest into line 2.

It would me nice to see $1,000,000,000,000.00 deposited into my account!
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Wed May 25, 2005 9:45 am    Post subject: Reply with quote

Quote:

It would me nice to see $1,000,000,000,000.00 deposited into my account!


Wouldn't it be nice if it was all in CASH? Mr. Green
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
dtf
Beginner


Joined: 10 Dec 2004
Posts: 110
Topics: 8
Location: Colorado USA

PostPosted: Wed May 25, 2005 11:18 am    Post subject: Reply with quote

If I count this right, it is a trillion dollars. I wonder if that much "cash" even exist.
________
vaporizer shop


Last edited by dtf on Tue Feb 01, 2011 1:54 pm; edited 1 time in total
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Wed May 25, 2005 11:40 am    Post subject: Reply with quote

Quote:

If I count this right, it is a trillion dollars.


dtf,

You are right as an American, but mervyn from UK might not agree with you as in England they call a trillion a billion Mr. Green

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Mervyn
Moderator


Joined: 02 Dec 2002
Posts: 415
Topics: 6
Location: Hove, England

PostPosted: Wed May 25, 2005 2:38 pm    Post subject: Reply with quote

Absolutely right! And a billion pounds sounds FAR more than a trillion dollars!
_________________
The day you stop learning the dinosaur becomes extinct
Back to top
View user's profile Send private message
Bithead
Advanced


Joined: 03 Jan 2003
Posts: 550
Topics: 23
Location: Michigan, USA

PostPosted: Wed May 25, 2005 2:43 pm    Post subject: Reply with quote

I guess it depends if it falls on you!
Back to top
View user's profile Send private message
Mervyn
Moderator


Joined: 02 Dec 2002
Posts: 415
Topics: 6
Location: Hove, England

PostPosted: Wed May 25, 2005 3:03 pm    Post subject: Reply with quote

You see the big hat in my picture? You wouldn't believe just how quickly I can turn that the other way up!!!
_________________
The day you stop learning the dinosaur becomes extinct
Back to top
View user's profile Send private message
Bithead
Advanced


Joined: 03 Jan 2003
Posts: 550
Topics: 23
Location: Michigan, USA

PostPosted: Wed May 25, 2005 3:11 pm    Post subject: Reply with quote

If it was a million pounds (lbs), I am not sure it matters which way up your hat is.....

It does have a remarkable slimming effect tho!
Back to top
View user's profile Send private message
raj_m
Beginner


Joined: 24 May 2005
Posts: 5
Topics: 2

PostPosted: Wed May 25, 2005 11:10 pm    Post subject: Reply with quote

Thanks a Very Happy Million!!!!!! Very Happy Guyz

I got the logic to accomplish this..

Raaj
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group