View previous topic :: View next topic
|
Author |
Message |
tapas84
New User
Joined: 12 Mar 2009 Posts: 23 Location: Bangalore
|
|
|
|
I'm reading two files of variable record length of 6000 bytes each into working storage section and writing records into a 2600 bytes variable length record byte into a sequential file. My problem is in my input file my first record is 100 bytes length and after that all are nulls till 6000 bytes but in my output after writing first 100 bytes its putting spaces. I want to remove all the spaces after the 100th byte of record and it should be a null character.
Note: I'm reading both 6000 byte files into working storage section and writing only 2600 bytes from my working storage section to output file.
Tapas. |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
Show us you FD's, record definitions, and read & writes. |
|
Back to top |
|
|
tapas84
New User
Joined: 12 Mar 2009 Posts: 23 Location: Bangalore
|
|
|
|
HI ,
here is the program
Code: |
00710020
FD B228TSFI-OUTPUT 00720020
RECORDING MODE IS V 00730020
LABEL RECORDS ARE STANDARD. 00740020
00750020
01 B228TSFI-REC. 00760020
05 FILLER PIC X(24). 00770020
05 B228TSFI-RECORD-SEQUENCE PIC S9(9) COMP-3. 00780020
05 FILLER PIC X(2571). 00790020
00800020 |
Thanks
Tapas |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
The attachment isn't formatted correctly. I had the same problem with a .txt attachment (as yours is also) several weeks ago.
Subsequently, the moderator replied and said that the attachment must be .doc (WORD format).
Regards, |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
Subsequently, the moderator replied and said that the attachment must be .doc (WORD format). |
This is not correct
.txt attachmates work - you just need to save them locally to see them (sometimes). .txt file attachments from the forum, opened in a browser window, are often "allruntogether". Saving the file to the hard drive, and then opening it in notepad or some other text editor shows them correctly.
Tapas,
Your output file needs an Occurs Depending On so the output length may be only the length of the data rather than the full length of the maximum possible record. You need to calculate the record length based on the content - if i understand your requirement. |
|
Back to top |
|
|
tapas84
New User
Joined: 12 Mar 2009 Posts: 23 Location: Bangalore
|
|
|
|
Hi Dick,
Thanks for your reply.
Can you please give me the code using 'occur depending on' with my program as I am bit confused as how to code it so that I will try out the same.
Thanks,
Tapas |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
One way to do what you want is to change the output FD to something like:
Code: |
01 B228TSFI-REC.
05 FILLER PIC X(24).
05 B228TSFI-RECORD-SEQUENCE PIC S9(9) COMP-3.
05 B228TSFI-NUMBER-OF-CHARS PIC S9(5) COMP-3.
05 B228TSFI-CHARS PIC X OCCURS 10 TO 2600
DEPENDING ON B228TSFI-NUMBER-OF-CHARS.
|
You would then calculate the number of characters by counting the trailing blanks and subtracting that count from the total length. |
|
Back to top |
|
|
tapas84
New User
Joined: 12 Mar 2009 Posts: 23 Location: Bangalore
|
|
|
|
Hi Dick,
Thanks a lot for your support.I tried out the same with occur depending on clause it worked but i got some other issue.like if my first input record is having 100 byte length and after that 10 byte of trailing spaces and if i use occur depending with inspect verb then its also making the input spaces to null which is not desired.so i am explaining my requirement fully.
Suppose my first input file is having 5 records and 2nd input file is having 5 records too.both input file is 6000 bytes of variable record length.but i would first read both the input files and write only 2600 bytes to output file.Here required logic is, it would write 4 records of the 1st input file into output file and when the control comes to last record of the 1st input file it would keep this last trailer record in some buffer area or in working storage section and it would start writting 1st record of 2nd input file one by one and once the control comes to the last record or traile record then it would put the data in working storage section and then it would write the 1st trailer record of the 1st input file into the output file then trailer record of 2nd file.
But the difficult thing is to copy the both input file as it received from different system.like if there is any spaces after any record then out put should also conatin the same.and if there is no trailing spaces then there shouldn't be any trailing spaces in out put file.Dick i know the explanation is too much but i am helpless.so please bear with me.is it possibe through any jcl sort/merge.In my application we are not using icetool.
please let me know if you are not clear with my queries.
Thanks
Tapas |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
One thing you need to do is document complete "rules".
Until you can clearly explain "the rules" it will not matter if you use cobol, sort, easytrieve, fileaid, etc. None will work until there is proper definition.
I suspect you need to break this down into individual pieces rather than one big jumble. Once you have broken the requirement into understandable parts, implementation will be more likely.
You do not need to work with thousands of bytes of input and output data. You can do the same manipulation with much smaller bits of data.
Quote: |
if i use occur depending with inspect verb then its also making the input spaces to null which is not desired |
I'm not sure what this is Why would the input be changed at all? |
|
Back to top |
|
|
tapas84
New User
Joined: 12 Mar 2009 Posts: 23 Location: Bangalore
|
|
|
|
copying both input file of 6000 VB length to one output file of 2600 VB length
-------------------------------------------------------------------------------
1. 2 input file of 6000 VB length, 1 output file of 2600 VB length
2. both input file contains- 5 records each
say for ex: 1st input file is
1111 <then 3 spaces and then Null same for all below records>
2222
3333
4444
5555
2nd input file is
6666 <then 3 spaces and then Null same for all below records>
7777
8888
9999
0000
then the output file should have like this
1111 <then 3 spaces and then Null same for all below records>
2222
3333
4444
6666
7777
8888
5555
9999
But the problem here is after copying, the output file is overriding the 3 spaces in it and making it to Null as well. But as per the requirement the output file should also have 3 spaces after the last character for one record.
I hope now I am clear with my requirement.
Please advise.
Immense thanks for your support.
Tapas |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
after copying, the output file is overriding the 3 spaces in it and making it to Null as well. |
This is being done by the code. The code needs to be modified to create output that has the 4-digits followed by the 3 spaces. No Nulls should be appended. The length used for the write wold be calculated and stored in the B228TSFI-NUMBER-OF-CHARS field.
Suggest you look at the vb output file in hex and make sure that the proper length is being created. If the record written is actually longer than the data you moved into the output record, x'00's may happen. . . |
|
Back to top |
|
|
tapas84
New User
Joined: 12 Mar 2009 Posts: 23 Location: Bangalore
|
|
|
|
Hi Dick,
I got what you are saying.. But I am facing diffuculty in finding the B228TSFI-NUMBER-OF-CHARS.
I am reading the input record to B228TRUS-REC which is of PIC X(5996).
Consider my I/P record is as belwo
12232445bbbbbnnnnnnnnnnnnnn
b -> Blanks
n -> Nulls.
I need the same content to be copied to output file. As you insisted I declared the O/P file record with Occurs clause.
To find the B228TSFI-NUMBER-OF-CHARS, i performed the below operation
OPTION 1:
INSPECT FUNCTION REVERSE(B228TRUS-REC) TALLYING WS-COUNT
FOR CHARACTERS BEFORE INITIAL SPACE.
When i display the ws-count, it is having value as 0
OPTION 2:
INSPECT FUNCTION REVERSE(B228TRUS-REC) TALLYING WS-COUNT
FOR LEADING LOW-VALUES.
When i display the ws-count, it is having value as 0
Could you please help me in getting the WS-COUNT excluding the nulls in that record. I think if i can able to get this one, i can solve this issue..
Looking forward for a positive response.
Thanks,
Tapas |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
If you have a field of 5996 bytes with value '12232445bbbbbnnnnnnnnnnnnnn ' and reverse it, you will get 5,983 spaces and then the nnnnnnnnnnnnnnbbbbb54423221. The option 1 INSPECT statement is working correctly and telling you that there are no characters before the first space. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello Tapas,
Is this now working?
If you tally the number of x'00' characters, how many are there?
If you tally from the beginning of the record (not reverse) until the first occurrance of x'0040', what value is in tally? Also if you tally from the beginning until x'4000'? |
|
Back to top |
|
|
tapas84
New User
Joined: 12 Mar 2009 Posts: 23 Location: Bangalore
|
|
|
|
Hi Dick,
Could you please help me in getting the tally count for the scenarios you mentioned???
I am not aware of how that has to be done..
Please help me in doing the same..
Regards,
Tapas |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
You could use "inspect B228TRUS-REC tallying until first . . ".
All you want is the displacement to the first occurrence of each of those hex values.
There seems to be confusion about exactly what the data contains and this is just an attempt to define the content (remotely as it were). As i mentioned earlier, before you can implement, the "rules" must all be known and the only to know the rules is to completely understand the data to be processed. . . |
|
Back to top |
|
|
|