View previous topic :: View next topic
|
Author |
Message |
kondru
New User
Joined: 22 Mar 2010 Posts: 11 Location: india
|
|
|
|
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 |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
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 |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
I take it a new group of graduates from the "ADVANCED COBOL CLASS" have started work. |
|
Back to top |
|
|
kondru
New User
Joined: 22 Mar 2010 Posts: 11 Location: india
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
1. STRING command
2. Reference modification
3. Arrays |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
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 "?"?
|
|
Back to top |
|
|
kondru
New User
Joined: 22 Mar 2010 Posts: 11 Location: india
|
|
|
|
It is not clear..for me |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
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 |
|
|
kondru
New User
Joined: 22 Mar 2010 Posts: 11 Location: india
|
|
|
|
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 |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
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 ( ) so I can't say more than that. |
|
Back to top |
|
|
dneufarth
Active User
Joined: 27 Apr 2005 Posts: 420 Location: Inside the SPEW (Southwest Ohio, USA)
|
|
|
|
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 |
|
|
|