|
View previous topic :: View next topic
|
| Author |
Message |
pema_yozer
New User

Joined: 16 Feb 2009 Posts: 54 Location: pune
|
|
|
|
Hi Experts,
I have the below proble,
I have a fixed lenght file with different record type.
the first two characers would determine the record type
01 header
02 data
03 different data
09 trailer
now some of the records for eg 02 04 06 may have one decimal fields(15,2)
but in different locations eg 10,20 30.
now based on this first two charecters i need to change the decimal to packed decimal. based on this record type
for ex rec type 01 09 08 needs nothign to be done.
if record type is 02 then decial field starting from position 10 needs to be converted to packed decimal,
if record type is 04 then starting from 20 needs to be converted |
|
| Back to top |
|
 |
pema_yozer
New User

Joined: 16 Feb 2009 Posts: 54 Location: pune
|
|
|
|
| the file is a fb with LRECL 54 |
|
| Back to top |
|
 |
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
pema_yozer,
| Quote: |
| now some of the records for eg 02 04 06 may have one decimal fields(15,2) |
What are all the record types and their respective decimal field position mapping? What about record type 03,05,07?
| Quote: |
| now based on this first two charecters i need to change the decimal to packed decimal. |
Do you want to overlay decimal with PD? I ask this because your PD Fields will be less in length than your decimal field? Do you want conversion with the same field length?
If possible, show your input with all the conditions covered and expected output.
Thanks, |
|
| Back to top |
|
 |
pema_yozer
New User

Joined: 16 Feb 2009 Posts: 54 Location: pune
|
|
|
|
below is my input data
016UKBADITM003 20100809
02008540003786200808180101ABCDEFGHIKJLMNON
03008540003786201004300000000000645.00
0401096001049920071031000000000100000008001
0500854000378620090305000000000102.000
0601095039440820090221035030000000000000.0000000000000000
070109605376162001020200000000070000000001000.00
99000000813782735000000064120100809
In the output every thing should be as it is except the red coloured ones.
the red coloured ones should be converted to
S9(13)v99 COMP-3 (packed decimal) |
|
| Back to top |
|
 |
pema_yozer
New User

Joined: 16 Feb 2009 Posts: 54 Location: pune
|
|
|
|
think can be converted to PD with the below code,
But can i do the convertion based on the codes ie i want teh convertion for only 03,05,06,07 |
|
| Back to top |
|
 |
pema_yozer
New User

Joined: 16 Feb 2009 Posts: 54 Location: pune
|
|
|
|
SORT FIELDS=COPY
OUTREC BUILD=(1,15,UFF,MUL,+100,TO=PD,LENGTH=13) |
|
| Back to top |
|
 |
pema_yozer
New User

Joined: 16 Feb 2009 Posts: 54 Location: pune
|
|
|
|
| it wouldn't bother me if the lengthof the pd is less |
|
| Back to top |
|
 |
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
pema_yozer,
Use below. You can conditionally check for first 2 bytes using IFTHEN and build or overlay fields at specified position.
| Code: |
//SORT01 EXEC PGM=SORT
//SORTIN DD DISP=SHR,DSN=YOUR.FB.LRECL54
//SORTOUT DD DSN=YOUR.FB.LRECL54.CNVT,
// DISP=(,CATLG,DELETE),
// UNIT=SYSDA
//SYSIN DD *
INREC IFTHEN=(WHEN=(01,02,CH,EQ,C'03'),
OVERLAY=(23:23,16,UFF,TO=PD,LENGTH=16)),
IFTHEN=(WHEN=(01,02,CH,EQ,C'05'),
OVERLAY=(32:32,07,UFF,TO=PD,LENGTH=07)),
IFTHEN=(WHEN=(01,02,CH,EQ,C'06'),
OVERLAY=(28:28,16,UFF,TO=PD,LENGTH=16)),
IFTHEN=(WHEN=(01,02,CH,EQ,C'07'),
OVERLAY=(33:33,16,UFF,TO=PD,LENGTH=16))
SORT FIELDS=COPY
/*
//SYSOUT DD SYSOUT=*
//* |
Thanks, |
|
| Back to top |
|
 |
pema_yozer
New User

Joined: 16 Feb 2009 Posts: 54 Location: pune
|
|
|
|
Thanks...
It works like a charm  |
|
| Back to top |
|
 |
pema_yozer
New User

Joined: 16 Feb 2009 Posts: 54 Location: pune
|
|
|
|
just one more question just out of curiosity,
if the above file was VB LRECL 80, would this still be possible.
if yes wat chnages would be needed in the above code. |
|
| Back to top |
|
 |
smijoss
Active User
Joined: 30 Aug 2007 Posts: 114 Location: pune
|
|
|
|
| yes .. just increment all the positions by 4 |
|
| Back to top |
|
 |
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
pema_yozer,
yes it works for VB of 80 bytes. For VB first 4 bytes are RDW and your data starts at position 5.
Please let me know if you still need JCL for that.
Thanks, |
|
| Back to top |
|
 |
pema_yozer
New User

Joined: 16 Feb 2009 Posts: 54 Location: pune
|
|
|
|
one thing i'm getting is that the packed fields record packed field is 15 bytes so S9(27)v99 comp-3 for record type 03,06 and 07 are
ut what is required is s9(15)v99 comp-3 |
|
| Back to top |
|
 |
pema_yozer
New User

Joined: 16 Feb 2009 Posts: 54 Location: pune
|
|
|
|
it should be s9(13)v99 comp-3, i think i have got it
OVERLAY=(23:23,16,SFF,TO=PD,LENGTH=08,X8)),
is working but for record type 6
0601095039440820090221035030000000000000.0000000000000000
as it is in the middle i get 8 spaces , how can this be avoided |
|
| Back to top |
|
 |
smijoss
Active User
Joined: 30 Aug 2007 Posts: 114 Location: pune
|
|
|
|
OVERLAY is used to "OVERLAY" the exisitng data
since your length will change dont use overlay use build
BUILD=(1,4,5,22,23,16,SFF,TO=PD,LENGTH=08,39) |
|
| Back to top |
|
 |
pema_yozer
New User

Joined: 16 Feb 2009 Posts: 54 Location: pune
|
|
|
|
save me a syntax error
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R10 - 14:57 ON TUE A
INREC IFTHEN=(WHEN=(01,02,CH,EQ,C'03'),
OVERLAY=(23:23,16,SFF,TO=PD,LENGTH=08,8X)),
IFTHEN=(WHEN=(01,02,CH,EQ,C'05'),
OVERLAY=(33:33,06,SFF,TO=PD,LENGTH=03,3X)),
IFTHEN=(WHEN=(01,02,CH,EQ,C'06'),
BUILD=(1,4,5,22,23,16,SFF,TO=PD,LENGTH=08,39),
IFTHEN=(WHEN=(01,02,CH,EQ,C'07'),
£
ICE006A 0 OPERAND DEFINER ERROR
OVERLAY=(33:33,16,SFF,TO=PD,LENGTH=08,8X))
£
ICE005A 0 BLANK NEEDED IN COLUMN 1 OR OPERATION NOT DEFINED CORRECTLY
SORT FIELDS=COPY
ICE751I 0 C5-K48846 C6-K90014 C7-K45047 C8-K46331 E7-K48846
ICE052I 3 END OF DFSORT |
|
| Back to top |
|
 |
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
pema_yozer,
It will be really helpful to understand if you could you please ask all your question in single post.
| Quote: |
one thing i'm getting is that the packed fields record packed field is 15 bytes so S9(27)v99 comp-3 for record type 03,06 and 07 are
ut what is required is s9(15)v99 comp-3 |
I could hardly understand anything from above.
| Quote: |
it should be s9(13)v99 comp-3, i think i have got it
OVERLAY=(23:23,16,SFF,TO=PD,LENGTH=08,X8)),
is working but for record type 6
0601095039440820090221035030000000000000.0000000000000000 |
What is X8, did you mean to add 8 space char. following packed decimal field? Why couldn't you just use LENGTH=16?
smijoss,
| Quote: |
| since your length will change dont use overlay use build |
I don't think his length is changing or he ever requested change in the length.
Thanks, |
|
| Back to top |
|
 |
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
pema_yozer,
If this is the card you want to execute, start your dfsort statement from 2nd column.
Thanks, |
|
| Back to top |
|
 |
pema_yozer
New User

Joined: 16 Feb 2009 Posts: 54 Location: pune
|
|
|
|
hi sqlcode,
wanted a 8 byte code but your code gave me a 16 byte,so i made it 8 byte and gave 8 blanks in the end.
This was fine for all other record type as the decimal was the last field followed by blank spaces.
How ever for record type 06 this didnt work as it gave blanks in between the records as the decimal was in b/w the recrd so was looking for a build code for it.
got one but it is giving a syntax error.
new to df sort and sorry for the confusion
Need to run the below code on the input record.
the red part must be converted to PD 8 byte and should be followed by remaining data immediately
0601095039440820090221035030000000000000.0000000000000000
BUILD=(1,4,5,22,23,16,SFF,TO=PD,LENGTH=08,39) |
|
| Back to top |
|
 |
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
pema_yozer,
You can still use OVERLAY, no need to use BUILD.
| Code: |
//SORT01 EXEC PGM=SORT
//SORTIN DD DISP=SHR,DSN=YOURID..FB.LRECL54
//SORTOUT DD DSN=YOURID.FB.LRECL54.CNVT,
// DISP=(,CATLG,DELETE),
// UNIT=SYSDA
//SYSIN DD *
INREC IFTHEN=(WHEN=(01,02,CH,EQ,C'03'),
OVERLAY=(23:23,16,UFF,TO=PD,LENGTH=08,8X)),
IFTHEN=(WHEN=(01,02,CH,EQ,C'05'),
OVERLAY=(32:32,07,UFF,TO=PD,LENGTH=03,4X)),
IFTHEN=(WHEN=(01,02,CH,EQ,C'06'),
OVERLAY=(28:28,16,UFF,TO=PD,LENGTH=08,8X)),
IFTHEN=(WHEN=(01,02,CH,EQ,C'07'),
OVERLAY=(33:33,16,UFF,TO=PD,LENGTH=08,8X))
SORT FIELDS=COPY
/*
//SYSOUT DD SYSOUT=*
//* |
OUTPUT
| Code: |
016UKBADITM003 20100809
02008540003786200808180101ABCDEFGHIKJLMNON
0300854000378620100430.....À&.
0401096001049920071031000000000100000008001
0500854000378620090305000000000... 0
060109503944082009022103503........ 00000000000
000
07010960537616200102020000000007........
99000000813782735000000064120100809
|
Thanks, |
|
| Back to top |
|
 |
pema_yozer
New User

Joined: 16 Feb 2009 Posts: 54 Location: pune
|
|
|
|
sqlcode1,
i have done the same thing and etting output as
[/code]
060109600104992010010703505 - 0000000000000
but for rec 6 i woul dwant output as
060109600104992010010703505 - 0000000000000
|
|
| Back to top |
|
 |
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
pema_yozer,
I don't see any difference in the 2 output you have posted.
Thanks, |
|
| Back to top |
|
 |
pema_yozer
New User

Joined: 16 Feb 2009 Posts: 54 Location: pune
|
|
|
|
the spaces are getting filled when i submit the post
060109600104992010010703505packeddecimalspaces0000000000000
060109600104992010010703505packeddecimal0000000000000
packed decimal = 8 byte packed decimal and the
spaces = 8 spaces
but i would require it as the second one
hope this makes sense |
|
| Back to top |
|
 |
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
I hate to keep this post going but are you still using FB? You had mentioned your question relating to VB was out of curiosity.
Please tell us if you are using VB or FB file. Reason I am asking is you are overlaying some of the fields (following your conversion) for record type 06 or may be I am missing some basic information.
Thanks, |
|
| Back to top |
|
 |
pema_yozer
New User

Joined: 16 Feb 2009 Posts: 54 Location: pune
|
|
|
|
i'm using FB.
and want the PD to be 8 bytes
i had used over lay to get the format
060109600104992010010703505packeddecimalspaces0000000000000
but this is incorrect due to the space and would require
060109600104992010010703505packeddecimal0000000000000
i think build should be used for this. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|