IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Dynamically Output file format


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
kondru

New User


Joined: 22 Mar 2010
Posts: 11
Location: india

PostPosted: Mon Apr 05, 2010 7:42 pm
Reply with quote

Hi,

I need to format the output file dynamically.

The output file has two fields
1. Name - PIC X(45)
2. Cause - PIC X( 45)

While writing to output file it should print as " Name" It should take only actual characters ( not 45 characters)i.e extra characters ( 45 - Actual Characters) It should not print spaces ? simillarly Cause also only actual characters. At the end there should not be any spaces.

Can you please any one help

Regards,
Kdr




[/quote][/code]
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Mon Apr 05, 2010 7:50 pm
Reply with quote

Quote:
Can you please any one help
OK, but how?
Please give some examples of your expected input and some examples of how you want that input to appear as output.
Also, include such details as recfm, lrecl and such for the input and output.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Mon Apr 05, 2010 8:09 pm
Reply with quote

I take it a new group of graduates from the "ADVANCED COBOL CLASS" have started work.
Back to top
View user's profile Send private message
kondru

New User


Joined: 22 Mar 2010
Posts: 11
Location: india

PostPosted: Mon Apr 05, 2010 8:15 pm
Reply with quote

The output file length was 133 Characters, The file is tab separated file

Before format Name& cause has been defied with 45 character length, So the output is reserving 45 character lenth irrespecting of actual length


Reprot before format
-------* Denotes Spaces
Name---------------------------------- Cause
aaaaaaaaaaaaaaaaaa---------------- xxxxxxxxxxxxxxxxxxxxxxxx----------
bbbbbb--------------------------------- yyyyyyyyyyyyyyy----------------------
ccccccccccccccccc--------------------- xxxxxx-----------------------------------
dddd------------------------------------ zzzzzzzzzzzzzzzzzzzzz------------------


Requirement demands - only tab shoul be the separator and no spaces to be left free in 45 character, What was defind to contain.

Reprot After format
Name Cause
aaaaaaaaaaaaaaaaaaa xxxxxxxxxxxxxxxxxxxxxxxxxxx
bbbbbb yyyyyyyyyyyyyyy
ccccccccccccccccc xxxxxx
dddd zzzzzzzzzzzzzzzzzzzzzzz

Regards,
KDR
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Mon Apr 05, 2010 8:38 pm
Reply with quote

1. STRING command
2. Reference modification
3. Arrays
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Apr 05, 2010 9:00 pm
Reply with quote

Hello,

Quote:
The output file length was 133 Characters
Requirement demands - only tab shoul be the separator and no spaces to be left free in 45 character
Either the output will be 133 or it won't. If it is 133, there will be trailing spaces (even if the spaces after name are removed). . .
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Mon Apr 05, 2010 9:05 pm
Reply with quote

Is this exactly what you mean?
kondru wrote:
Code:
-------* Denotes Spaces
Name---------------------------------- Cause
aaaaaaaaaaaaaaaaaa---------------- xxxxxxxxxxxxxxxxxxxxxxxx----------
bbbbbb--------------------------------- yyyyyyyyyyyyyyy----------------------
ccccccccccccccccc--------------------- xxxxxx-----------------------------------
dddd------------------------------------ zzzzzzzzzzzzzzzzzzzzz------------------
Code:
Name Cause
aaaaaaaaaaaaaaaaaaa xxxxxxxxxxxxxxxxxxxxxxxxxxx
bbbbbb yyyyyyyyyyyyyyy
ccccccccccccccccc xxxxxx
dddd zzzzzzzzzzzzzzzzzzzzzzz

Code:
                                  v
aaaaaaaaaaaaaaaaaa---------------- xxxxxxxxxxxxxxxxxxxxxxxx----------
                                  ?
                   V
aaaaaaaaaaaaaaaaaaa xxxxxxxxxxxxxxxxxxxxxxxxxxx
                   ?

If "-------* Denotes Spaces" what does the questioned character denote?
Is it a type that the output has an extra "a"?
The input appears to be variable unless the characters trailing the "-" are the same as the "?".
the output appears to be variable unless the characters trailing the "Cause" are the same as the "?"?

William Thompson wrote:
Whenever indentation or columnar representation is needed, desired or just helpful, try this:

Create the text in notepad with a fixed font like "Courier New" to get the alignment you want.
Do not try to align the columns in the "Post a reply/Quick Reply" box, the font is proportional, not fixed.
After setting everything up in Notepad, cut and paste to the "Post a reply/Quick Reply" box.
Then, second most importantly, highlight the text and click the "Code" button.
And the very most important thing, PREVIEW the result before submitting it.
Back to top
View user's profile Send private message
kondru

New User


Joined: 22 Mar 2010
Posts: 11
Location: india

PostPosted: Mon Apr 05, 2010 11:04 pm
Reply with quote

It is not clear..for me
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Apr 05, 2010 11:12 pm
Reply with quote

Hello,

Quote:
It is not clear..for me
It is up to you to make it clear. . . for us.

If you don't know what that goal is, it will be nearly impossible for us help you reach that goal.

Suggest you speak with someone in your organization and decide what is really needed. . . Once decided, post what you learn, and someone should be able to offer an approach. . .
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Mon Apr 05, 2010 11:24 pm
Reply with quote

kondru wrote:
It is not clear..for me
Join the club, your need are not clear to me either.

Just guessing:
You have a 133 byte record where the name is always first, no leading blanks and after the name, one or more blanks to the cause and after the cause, more blanks up to the end of the record, right?
You want a 45 byte output file with all but one blank squeezed out of the space between the name and the cause with any space after the cause to be blanks, right?

Quote:
Requirement demands - only tab shoul be the separator and no spaces to be left free in 45 character
Is this tab in the input?
Is theis tab to be the one character separating the name from the cause?
By "no spaces to be left free" you mean between the name and the cause, but will allow spaces after the cause?

Please answer these questions as well as you can.
Back to top
View user's profile Send private message
kondru

New User


Joined: 22 Mar 2010
Posts: 11
Location: india

PostPosted: Tue Apr 06, 2010 12:41 pm
Reply with quote

Sorry..I am confusing you all... I will try to give more input.


I am reading a input file of length 450 and i am trying to write output file of length 133

Output file : - I am reading name of the account holder and cause of each lenth 45. The output file should look like:
name+'09'+cause+'09'. ( '09' TAB separated)

But for every record the length is changing, since it has been declared as 45, 45 length has been reserved for each field and there are some spaces left in name & cause at tail. I need to eliminate the spaces in name & Cause. and the record should look like this
name+'09'+cause+'09'. ( '09' TAB separated)

Can you please suggest me the best way to do this
Thanks.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Tue Apr 06, 2010 3:02 pm
Reply with quote

kondru wrote:
Sorry..I am confusing you all... I will try to give more input.
OK, but aside from the 'tab' info, you still are confusing us...

Can you browse the input file?
Can you cut & paste the first couple lines back here?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Apr 06, 2010 9:23 pm
Reply with quote

Hello,

Yes, you can create output that contains name, x'09', cause, x'09' with little difficulty.

What should come after the second x'09'? Before the name? Should all of the output records be 133 or should they vary in length?

You need to show a more complete example of that you want as output.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Tue Apr 06, 2010 9:58 pm
Reply with quote

So, you want to create a file that can be opened later in EXCEL ??
Why didn't you just say it from the beginning ???
Just in case I guessed correctly:

Some explanations about possible formats:

If you use TAB as the separator between the cells, then on the PC you have to name the file with .TXT extension.
To open it in Excel, you'll have to right click the file, choose "Open with" and look for Excel.

If you use a comma as the separator, you can name your file with .CSV extension.
Then on the PC you need only double click the file to open it in Excel.


About your question:

Use less words and more realistic examples:

Sample input file (record has fixed length of 450 bytes, each field is 45 bytes long, Name starts in col 1 and Cause in col 46):
Code:
Name                   Cause
Shivkumar Sharma       Santur
Ravi Shankar           Sitar
Hariprasad Chaurasia   Flute
Zakir Hussein          Tabla

Sample output file (the char ^ represents x'09' a tab char, record has fixed length of 133 bytes):
Code:
Name^Cause^
Shivkumar Sharma^Santur^
Ravi Shankar^Sitar^
Hariprasad Chaurasia^Flute^
Zakir Hussein^Tabla^


I am almost certain this can be accomplished using SORT.
Unfortunately, I am not a sort expert ( icon_sad.gif ) so I can't say more than that.
Back to top
View user's profile Send private message
dneufarth

Active User


Joined: 27 Apr 2005
Posts: 419
Location: Inside the SPEW (Southwest Ohio, USA)

PostPosted: Tue Apr 06, 2010 10:14 pm
Reply with quote

Marso,

nice job of reading between the lines and postulating some criteria/examples; hope it turns out to be the correct scenario.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Populate last day of the Month in MMD... SYNCSORT 2
Search our Forums:

Back to Top