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
 

 

Dynamically Output file format

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Dynamically Output file format
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: 2150
Location: At my coffee table

PostPosted: Mon Apr 05, 2010 7:50 pm    Post subject:
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    Post subject:
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    Post subject: Reply to: Dynamically Output file format
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: 7908
Location: Bellevue, IA

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

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

Site Director


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

PostPosted: Mon Apr 05, 2010 9:00 pm    Post subject:
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: 2150
Location: At my coffee table

PostPosted: Mon Apr 05, 2010 9:05 pm    Post subject:
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    Post subject:
Reply with quote

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

Site Director


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

PostPosted: Mon Apr 05, 2010 11:12 pm    Post subject:
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: 2150
Location: At my coffee table

PostPosted: Mon Apr 05, 2010 11:24 pm    Post subject:
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    Post subject:
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: 2150
Location: At my coffee table

PostPosted: Tue Apr 06, 2010 3:02 pm    Post subject:
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

Site Director


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

PostPosted: Tue Apr 06, 2010 9:23 pm    Post subject:
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: 1219
Location: Israel

PostPosted: Tue Apr 06, 2010 9:58 pm    Post subject: Reply to: Dynamically Output file format
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: 236
Location: Cincinnati OH USA

PostPosted: Tue Apr 06, 2010 10:14 pm    Post subject:
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    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 Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm


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