View previous topic :: View next topic
|
Author |
Message |
Deepa.m
New User
Joined: 28 Apr 2005 Posts: 99
|
|
|
|
How to insert zero's (not binary zero's) in the file using outrec?
Like
outrec (1,10 420Z,11, 20)
with this statement i could insert only binary zero's.likewise i want to insert numeric 0 in 420 bytes ( F0)
details:
Sortin: FB
File length 7116
i have to insert 420 bytes of numeric 0 after 7096 and then copy the remaining bytes after 7097 to create sortout
-deepa |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
You can use 420C'0' or 420X'F0'. |
|
Back to top |
|
|
Deepa.m
New User
Joined: 28 Apr 2005 Posts: 99
|
|
|
|
After adding 0's with the control card suggested by you I am getting invalid data if i view the file in file-aid as Comp-3 variable.
actually I have to read this file(in which we inserted 0's ) using a comp-3 variable in a copybook and move it to other variable in our program.
program executed successfully but the output file has invalid data and not 0's as we inserted.
-deepa |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Sigh. You didn't say these were COMP-3 variables. COMP-3 is PD (packed decimal). You said you wanted X'F0' - that's a ZD zero, not a PD zero. A 1-byte PD zero is X'0C', a 2-byte PD zero is X'000C', etc. If you want 420 1-byte PD zero values, that would be 420X'0C'. If you want something else (e.g. 2-byte PD zero values), you need to say exactly what it is you want. |
|
Back to top |
|
|
Deepa.m
New User
Joined: 28 Apr 2005 Posts: 99
|
|
|
|
Even after making this changes 420X'0C' the field shows invalid with comp-3 variable when viewed through file-aid. it has not inserted 0 in the file.
-Deepa |
|
Back to top |
|
|
IQofaGerbil
Active User
Joined: 05 May 2006 Posts: 183 Location: Scotland
|
|
|
|
what does the file look like when viewed in hex mode (not via file-aid) ? |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
X'0C' is a valid 1-byte PD value. I suspect you don't really want 1-byte PD values and that's not what FileAid is looking at, but you don't seem to actually know what you need so it's hard to help you. How does FileAid know the format of the field? Is there a layout of some kind it uses? If so, what is it using for the description of the field? And what does it display for the field? |
|
Back to top |
|
|
Deepa.m
New User
Joined: 28 Apr 2005 Posts: 99
|
|
|
|
Frank,
I believe I expalined my problem clearly. but still i haven't got the solution. I will go still deeper to expalin my query.
I have a got a file with size 7716 ..for my program needs i need to expand this length to 7836 ( 120 bytes more ..now the requirement changed from 420 120 ..it happens :-)) the layout for this 120 bytes is
03 LNB-PSE-CV-FACTOR-SCHEDULE OCCURS 30 TIMES.
04 LNB-PSE-CV-FACTOR PIC S9V9(5) USAGE COMP-3.
03 FILLER PIC X(21).
hope I am clear.
now with our sortin card I added 4*30 =120 bytes of PD 0
SORT FIELDS=COPY
OUTREC FIELDS=(1,7696,30X''0000000C'',7697,20)
and my file becomes 7836 . when I view with the above alyout ..instead of 0 I am getting Invalid fields
LNB-PSE-CV-FACTOR(17) LNB-PSE-CV-FACTOR(18) LNB-PSE-CV-FACTOR(19)
4/PS 4/PS 4/PS
(7760-7763) (7764-7767) (7768-7771)
150------------------ 150------------------ 150------------------
***************************** TOP OF DATA ******************-CAPS
INVALID INVALID INVALID
INVALID INVALID INVALID
INVALID INVALID INVALID
INVALID INVALID INVALID
INVALID INVALID INVALID
INVALID INVALID INVALID
INVALID INVALID INVALID
INVALID INVALID INVALID
INVALID INVALID INVALID
INVALID INVALID INVALID
INVALID INVALID INVALID
in hex mode the same file is seen as below (0's are not seen)
000001
00000000000000000000000000000000000000000000000000004
000C000C000C000C000C000C000C000C000C000C000C000C000C0
------------------------------------------------------------
000002
00000000000000000000000000000000000000000000000000004
000C000C000C000C000C000C000C000C000C000C000C000C000C0
. . . . . . . . . . . . . . . . . . . .
I gave you as much details I can to describe this issue..Can you suggest a solution |
|
Back to top |
|
|
IQofaGerbil
Active User
Joined: 05 May 2006 Posts: 183 Location: Scotland
|
|
|
|
I tried this myself and my fileaid looks like this (ie fine!)
are you sure that your layout matches the file?
RECORD: 1
---- FIELD LEVEL/NAME ------- -FORMAT- ----+----1--
2 FILLER (POS 7269-7360)
(POS 7361-7452)
(POS 7453-7544)
(POS 7545-7636)
(POS 7637-7696)
2 LNB-PSE-CV-FACTOR-SCHEDULE(1) OCCURS 30 TIMES
4/GRP
4 LNB-PSE-CV-FACTOR(1) 4/PS 0
2 LNB-PSE-CV-FACTOR-SCHEDULE(2)
4/GRP
4 LNB-PSE-CV-FACTOR(2) 4/PS 0
2 LNB-PSE-CV-FACTOR-SCHEDULE(3)
4/GRP
4 LNB-PSE-CV-FACTOR(3) 4/PS 0
2 LNB-PSE-CV-FACTOR-SCHEDULE(4)
4/GRP
4 LNB-PSE-CV-FACTOR(4) 4/PS 0
2 LNB-PSE-CV-FACTOR-SCHEDULE(5)
4/GRP
4 LNB-PSE-CV-FACTOR(5) 4/PS 0 |
|
Back to top |
|
|
IQofaGerbil
Active User
Joined: 05 May 2006 Posts: 183 Location: Scotland
|
|
|
|
in fact should the start position of LNB-PSE-CV-FACTOR(1) not be 7697 (ie 7696+1) and thus all subsequent start positions for your new fields will be an odd number.
Your layout shows them all with an even number. I think you might be one byte out for each. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
I believe I expalined my problem clearly. |
Was that when you said
Quote: |
i want to insert numeric 0 in 420 bytes ( F0) |
or when you couldn't tell me if you need 1-byte PD zeros or n-byte PD zeros? I was trying to help based on what YOU told me - perhaps I shouldn't have bothered.
It appears you actually want 4-byte PD zeros and you managed to get them, but you probably have them in the wrong place as IQofaGerbil says. |
|
Back to top |
|
|
Deepa.m
New User
Joined: 28 Apr 2005 Posts: 99
|
|
|
|
Thank you very much for your valuable solutions.. |
|
Back to top |
|
|
|