|
|
| Author |
Message |
maxsubrat
New User
Joined: 27 Feb 2008 Posts: 8 Location: india
|
|
|
|
Hi,
I have a requirement like to update a header only..
For eg..
DIVHDR046B780203 0000582510807072006281080701
001060.ë..Ì....Ø................. ............
001178.ë..ÏÂ...à&................ ............
001216.ë..ÏÂ...à&................ ............
001242.ë..ÏÂ....Ø................ ............
etc....
The 1st line is a header(there is only one header) and i want to change the DIVHDR046 to DIVHDR053 , if it is any other value other than 046 also i want to change it to 053.
But i don't want to touch any other record.. only that header i mention want to change to 053..
Please someone help me to give the sort utility to do that.. |
|
| Back to top |
|
 |
References
|
|
 |
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1132 Location: Mumbai - India
|
|
|
|
max,
| Quote: |
I have a requirement like to update a header only..
|
As the first few bytes of your header record is unique, you can use "IF THEN and OVERLAY" for your requirement.
Search this forum and you would find similar examples. |
|
| Back to top |
|
 |
ParagChouguley
Active User
Joined: 03 Feb 2007 Posts: 156 Location: PUNE(INDIA)
|
|
|
|
| Quote: |
and i want to change the DIVHDR046 to DIVHDR053 , if it is any other value other than 046 also i want to change it to 053.
|
If I have understood correctly, here is a SYNCSORT job for your requirement.
| Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
DIVHDR046B780203 0000582510807072006281080701
001060.ë..Ì....Ø................. ............
001178.ë..ÏÂ...à&................ ............
001216.ë..ÏÂ...à&................ ............
001242.ë..ÏÂ....Ø................ ............
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
OUTREC IFTHEN=(WHEN=(1,6,CH,EQ,C'DIVHDR'),
OVERLAY=(1:C'DIVHDR053')),
IFTHEN=(WHEN=NONE,
OVERLAY=(1:1,1))
/*
|
--Parag |
|
| Back to top |
|
 |
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1132 Location: Mumbai - India
|
|
|
|
parag,
| Quote: |
IFTHEN=(WHEN=NONE,
OVERLAY=(1:1,1)) |
Is this really needed? |
|
| Back to top |
|
 |
ParagChouguley
Active User
Joined: 03 Feb 2007 Posts: 156 Location: PUNE(INDIA)
|
|
|
|
I guess, not !
I modified an existing sort card which contained "when=None" part, so kept as it is! |
|
| Back to top |
|
 |
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1132 Location: Mumbai - India
|
|
|
|
Parag,
Oh ok. |
|
| Back to top |
|
 |
maxsubrat
New User
Joined: 27 Feb 2008 Posts: 8 Location: india
|
|
|
|
Hi,
There is one new requirement in the same file above..
This is the layout of the copybook
position
01 D87103W1-INPUT-RECORD.
05 D87103W1-MEINBR PIC X(6). 1-6
05 D87103W1-MEPNBR PIC S9(6) COMP-3. 7-10
The file record are like that:
D87103W1 D87103W1
MEINBR MEPNBR
C 6 PS 4
1------- 7-------
****** ******************
000001 DIVHDR X'F0F4+
000002 001060 53053
000003 001178 53053
000004 001216 53053
000005 001242 53053
000006 001521 53053
000007 001875 53053
000008 001949 53053
like that lot of records are there, but there is one header only..
The field MEPNBR which looks 53053 in all the records,
but it should populated as 053053, but the left 0 looks suppressing..
I want in all the records the MEPNBR should be 053053, This field as i mentioned defined as a packed decimal.
and the header should not be affected anyway...
Please let me know how to encounter this requirement... whether go for the program change , if change then what should be the changed one.. or need to do it with any sort utility..
Thanks |
|
| Back to top |
|
 |
ParagChouguley
Active User
Joined: 03 Feb 2007 Posts: 156 Location: PUNE(INDIA)
|
|
|
|
maxsubrat,
Pls use "Code" option and then post sample records of your Input file, so that position and lengths of fields can be understood better.
Moreover, you say
| Quote: |
but it should populated as 053053, but the left 0 looks suppressing..
|
Is the zero really suppressed or is it missing ? |
|
| Back to top |
|
 |
maxsubrat
New User
Joined: 27 Feb 2008 Posts: 8 Location: india
|
|
|
|
I am giving details from beginning,
There is only one header and 3000 records in my file..
and there is a Field called LOCNBR in the file,
it is declared as PIC S9(6) COMP-3
The position is like that:
1. SINO PIC X(6)
2. LOCNBR PIC S9(6) COMP-3
When we receive the file we are getting the LOCNBR as 53053 but actually it is 053053.
so the left zero is supressing,
can we do something that the field shows like 053053, while currently it is showing as 53053..
so we have to do in such a way that the header should not be affected, but the left zero should display in all the records in the output process file as 053053..
see below the layout:
DIVHDR046B780203 0000582510807072006281080701
001060 53053
001178 53053
...like that it continues
plse give ur views how to make the changes .. whether in programs or in jobs..
Thanks |
|
| Back to top |
|
 |
dick scherrer
Global Moderator
Joined: 23 Nov 2006 Posts: 8599 Location: 221 B Baker St
|
|
|
|
Hello,
| Quote: |
| When we receive the file we are getting the LOCNBR as 53053 but actually it is 053053. |
How do you know this? A packed-decimal (Comp-3) number in a file is not visable. . . What you have posted is not comp-3 data. . .
Please post the first 30 bytes of the first few records in your file in HEX. |
|
| Back to top |
|
 |
maxsubrat
New User
Joined: 27 Feb 2008 Posts: 8 Location: india
|
|
|
|
| if u open in 3.4 option then u cann't see the proper data, but if u open in File-aid then u can see the datas.. |
|
| Back to top |
|
 |
dick scherrer
Global Moderator
Joined: 23 Nov 2006 Posts: 8599 Location: 221 B Baker St
|
|
|
|
Hello,
Open the file in 3.4, then use HEX ON.
From that display, post the info i asked for. |
|
| Back to top |
|
 |
maxsubrat
New User
Joined: 27 Feb 2008 Posts: 8 Location: india
|
|
|
|
This is the plain format(HEX off )
| Code: |
000001 DIVHDR053B780203 0000582510807072006281080701
000002 001060 ë Ì Ø
000003 001178 ë ÏÂ à&
000004 001216 ë ÏÂ à&
000005 001242 ë ÏÂ Ø |
.
.
.
.
and this is the hex on format:
| Code: |
000001 DIVHDR053B780203 00005825108
CCECCDFFFCFFFFFF4FFFFFFFFFFF
4958490532780203000005825108
-----------------------------------
000002 001060 ë Ì Ø
FFFFFF0503730008100000000300
001060035F82F0300F0000F00F00
-----------------------------------
000003 001178 ë ÏÂ à&
FFFFFF0503763004500000000200
001178035F72F0540F0000F00F00 |
Thanks |
|
| Back to top |
|
 |
dick scherrer
Global Moderator
Joined: 23 Nov 2006 Posts: 8599 Location: 221 B Baker St
|
|
|
|
Hello,
| Quote: |
| plse give ur views how to make the changes .. whether in programs or in jobs.. |
I believe there are no changes needed. The data in the file is stored correctly.
When you reference the comp-3 fields in a program, you will get the correct results.
Your only problem that i can see was understanding that the data in the file is correct. |
|
| Back to top |
|
 |
maxsubrat
New User
Joined: 27 Feb 2008 Posts: 8 Location: india
|
|
|
|
Boss,
The main problem is the 2nd field which the value is 053053, but in our report the left 0 is suppressing, like 53053....
but i want in my output report the 2nd field should be 053053 without suppressing the left 0..
Thanks |
|
| Back to top |
|
 |
|
|