|
View previous topic :: View next topic
|
| Author |
Message |
speermb
New User
Joined: 27 Aug 2008 Posts: 30 Location: USA
|
|
|
|
Please help what am I doing wrong. The data is correct for 90% but it is messing up on some. Why is the GB record getting what it is. GB,"UNITED KINGDOM (ENGLAND WALES SCOTLAND NO. IRELAND) UN"TED,KINGDOM
I am just not seeing the issue. I'm going crazy it works on most the input. What am I missing??
| Code: |
//TOOLIN DD *
COPY FROM(INDD01) TO(TMPDD01) USING(FMT1)
//FMT1CNTL DD *
INREC FINDREP=(IN=C',',OUT=C'')
OUTFIL FNAMES=TMPDD01,
IFTHEN=(WHEN=INIT,
OVERLAY=(1:1,2,
3,55,JFY=(SHIFT=LEFT,LEAD=C'"',TRAIL=C'"'),
58,40,JFY=(SHIFT=LEFT,LEAD=C'"',TRAIL=C'"'),
98,100,JFY=(SHIFT=LEFT,LEAD=C'"',TRAIL=C'"'),
198,100,JFY=(SHIFT=LEFT,LEAD=C'"',TRAIL=C'"'),
298,100,JFY=(SHIFT=LEFT,LEAD=C'"',TRAIL=C'"'),
398,100,JFY=(SHIFT=LEFT,LEAD=C'"',TRAIL=C'"'),
498,1,C',')),
IFTHEN=(WHEN=INIT,
BUILD=(1,2,C',',3,499,
SQZ=(SHIFT=LEFT,PAIR=QUOTE,PREBLANK=C'"',MID=C',')))
|
iNPUT:
| Code: |
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2----
000082 GBUNITED KINGDOM (ENGLAND, WALES, SCOTLAND, NO. IRELAND) UNITED KINGDOM UNITED KINGDOM
CCEDCECC4DCDCCDD44CDCDCDC64ECDCE64ECDEDCDC64DD44CDCDCDC54EDCECC4DCDCCDD44444444444444444444444444EDCECC4DCDCCDD4444444444444
72459354029574640D5573154B061352B023633154B056B09953154D04593540295746400000000000000000000000000459354029574640000000000000
----------------------------------------------------------------------------------------------------------------------------------
000083 GDGRENADA GRENADA GRENADA
CCCDCDCCC444444444444444444444444444444444444444444444444CDCDCCC444444444444444444444444444444444CDCDCCC44444444444444444444
7479551410000000000000000000000000000000000000000000000007955141000000000000000000000000000000000795514100000000000000000000
----------------------------------------------------------------------------------------------------------------------------------
000084 GEGEORGIA GEORGIA GEORGIA
CCCCDDCCC444444444444444444444444444444444444444444444444CCDDCCC444444444444444444444444444444444CCDDCCC44444444444444444444
7575697910000000000000000000000000000000000000000000000007569791000000000000000000000000000000000756979100000000000000000000
----------------------------------------------------------------------------------------------------------------------------------
000085 GFFRENCH GUIANA FRENCH GUIANA FRENCH GUIANA
CCCDCDCC4CECCDC444444444444444444444444444444444444444444CDCDCC4CECCDC444444444444444444444444444CDCDCC4CECCDC44444444444444
7669553807491510000000000000000000000000000000000000000006955380749151000000000000000000000000000695538074915100000000000000
----------------------------------------------------------------------------------------------------------------------------------
000086 GGGUERNSEY GUERNSEY GUERNSEY
CCCECDDECE44444444444444444444444444444444444444444444444CECDDECE44444444444444444444444444444444CECDDECE4444444444444444444
7774595258000000000000000000000000000000000000000000000007459525800000000000000000000000000000000745952580000000000000000000
----------------------------------------------------------------------------------------------------------------------------------
000087 GHGHANA GHANA GHANA
CCCCCDC44444444444444444444444444444444444444444444444444CCCDC44444444444444444444444444444444444CCCDC4444444444444444444444
7878151000000000000000000000000000000000000000000000000007815100000000000000000000000000000000000781510000000000000000000000 |
OUTPUT
| Code: |
GB,"UNITED KINGDOM (ENGLAND WALES SCOTLAND NO. IRELAND) UN"TED,KINGDOM
GD,"GRENADA","GRENADA","GRENADA","GRENADA","","",N,
GE,"GEORGIA","GEORGIA","GEORGIA","GEORGIA","","",N,
GG,"GUERNSEY","GUERNSEY","GUERNSEY","","","UNITED KINGDOM",N,
GI,"GIBRALTAR","GIBRALTAR","GIBRALTAR","","","UNITED KINGDOM",N,
|
Desired output
| Code: |
GB,"UNITED KINGDOM (ENGLAND WALES SCOTLAND NO. IRELAND)","UNTED KINGDOM","UNTED KINGDOM","",N,
GD,"GRENADA","GRENADA","GRENADA","GRENADA","","",N,
GE,"GEORGIA","GEORGIA","GEORGIA","GEORGIA","","",N,
GG,"GUERNSEY","GUERNSEY","GUERNSEY","","","UNITED KINGDOM",N,
GI,"GIBRALTAR","GIBRALTAR","GIBRALTAR","","","UNITED KINGDOM",N,
|
|
|
| Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2276 Location: USA
|
|
|
|
Try to run without JFY parameters, then add them one by one until this issue occurred again.
Then you can narrow the suspicious area. |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
speermb,
You might want to change this
| Code: |
| INREC FINDREP=(IN=C',',OUT=C'') |
to
| Code: |
| INREC FINDREP=(IN=C',',OUT=C' ') |
to replace with a blank instead of 'nothing' coz that messes up the positions in your OVERLAY. With your FINDREP, the data shifts to the left for each comma replaced. |
|
| Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2276 Location: USA
|
|
|
|
| Arun Raj wrote: |
speermb,
You might want to change this
| Code: |
| INREC FINDREP=(IN=C',',OUT=C'') |
to
| Code: |
| INREC FINDREP=(IN=C',',OUT=C' ') |
to replace with a blank instead of 'nothing' coz that messes up the positions in your OVERLAY. With your FINDREP, the data shifts to the left for each comma replaced. |
On my tablet screen, I was not able to distiguish between commas and dots in the input records.
There are really two commas in the input record, causing the rest of data to sheet two positions left (after FINDREP). So, the 'UN' from the last field moved to previous field becoming last two characters of it.
Really, replacement all commas with explicit space characters should help.
Even better solution might be using parameter PREBLANK=C',' in JFY, instead of FINDREP.
I'd like to note that I prefer giving some hints to TS, as in my first reply, just to make the TS to find his problem by himself. It' not good idea to give ready solutions on user's own errors. |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
| sergeyken wrote: |
There are really two commas in the input record, causing the rest of data to sheet two positions left (after FINDREP). So, the 'UN' from the last field moved to previous field becoming last two characters of it.
|
There are 3 commas in the input, so the 'UNI' is pushed to the previous field.
After FINDREP:
| Code: |
----+----1----+----2----+----3----+----4----+----5----+
UNITED KINGDOM (ENGLAND WALES SCOTLAND NO. IRELAND) UNI |
After JFY :
| Code: |
----+----1----+----2----+----3----+----4----+----5----+
"UNITED KINGDOM (ENGLAND WALES SCOTLAND NO. IRELAND) UN |
|
|
| Back to top |
|
 |
speermb
New User
Joined: 27 Aug 2008 Posts: 30 Location: USA
|
|
|
|
Thanks for the response.
I had actually figured out this INREC FINDREP=(IN=C',',OUT=C'') was bad and changed to INREC FINDREP=(IN=C',',OUT=C' '. That was still causing field length error where I got:
| Code: |
GB,"UNITED KINGDOM (ENGLAND WALES SCOTLAND NO IRELAND)"UNITED,KINGDO
|
So I updated the code to PREBLANK=C',' on each field expecting it to make all commas in field 3,55 a space.
| Code: |
IFTHEN=(WHEN=INIT,
BUILD=(1:1,2,C',',
003,055,JFY=(SHIFT=LEFT,PREBLANK=C',',
LEAD=C'"',TRAIL=C'"',LENGTH=57),
058,040,JFY=(SHIFT=LEFT,PREBLANK=C',',
LEAD=C'"',TRAIL=C'"',LENGTH=42),
098,100,JFY=(SHIFT=LEFT,PREBLANK=C',',
LEAD=C'"',TRAIL=C'"',LENGTH=102),
198,100,JFY=(SHIFT=LEFT,PREBLANK=C',',
LEAD=C'"',TRAIL=C'"',LENGTH=102),
298,100,JFY=(SHIFT=LEFT,PREBLANK=C',',
LEAD=C'"',TRAIL=C'"',LENGTH=102),
398,100,JFY=(SHIFT=LEFT,PREBLANK=C',',
LEAD=C'"',TRAIL=C'"',LENGTH=102),
498,1,C','))
|
but the data is still not replacing the ',' in the fields
| Code: |
FM,"MICRONESIA, FEDERATED STATES OF" "MICRONESIA,
FO,"FAROE ISLANDS" "FAROE ISLAN
FR,"FRANCE" "FRANCE"
GA,"GABON" "GABON"
GB,"UNITED KINGDOM (ENGLAND, WALES, SCOTLAND, NO. IRELAND)" "UNITED KING
|
how do I get
| Code: |
FM,"MICRONESIA FEDERATED STATES OF" "MICRONESIA,
FO,"FAROE ISLANDS" "FAROE ISLAN
FR,"FRANCE" "FRANCE"
GA,"GABON" "GABON"
GB,"UNITED KINGDOM (ENGLAND WALES SCOTLAND NO. IRELAND)" "UNITED KING
|
[/code] |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
| sergeyken wrote: |
Even better solution might be using parameter PREBLANK=C',' in JFY, instead of FINDREP.
|
PREBLANK in JFY can replace only specific leading or trailing characters to blanks before justify processing, not the ones embedded in a field. So it does not apply here. |
|
| Back to top |
|
 |
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1216 Location: Dublin, Ireland
|
|
|
|
| Quote: |
| PREBLANK can replace only specific leading or trailing characters to blanks before justify processing, not the ones embedded in a field. So it does not apply here. |
Incorrect, it will preblank all instances. I've just checked on my system.
Garry |
|
| Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2276 Location: USA
|
|
|
|
| Quote: |
- How do I create a working product?
- Just take a piece of shit, and remove unneeded parts of it. |
| Code: |
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
GBUNITED KINGDOM (ENGLAND, WALES, SCOTLAND, NO. IRELAND) UNITED KINGDOM
GDGRENADA GRENADA
GEGEORGIA GEORGIA
GFFRENCH GUIANA FRENCH GUIANA
GGGUERNSEY GUERNSEY
GHGHANA GHANA
|
| Code: |
INREC FINDREP=(INOUT=(C',',C' '))
SORT FIELDS=COPY
OUTREC FIELDS=(1:1,2,C',',
003,055,SQZ=(SHIFT=LEFT,MID=C' ',
LEAD=C'"',TRAIL=C'"',LENGTH=57),
058,015,SQZ=(SHIFT=LEFT,MID=C' ',
LEAD=C'"',TRAIL=C'"',LENGTH=17),
C',')
END
|
| Code: |
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
GB,"UNITED KINGDOM (ENGLAND WALES SCOTLAND NO. IRELAND)" "UNITED KINGDOM" ,
GD,"GRENADA" "GRENADA" ,
GE,"GEORGIA" "GEORGIA" ,
GF,"FRENCH GUIANA" "FRENCH GUIANA" ,
GG,"GUERNSEY" "GUERNSEY" ,
GH,"GHANA" "GHANA" ,
|
|
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
| Garry Carroll wrote: |
Incorrect, it will preblank all instances. I've just checked on my system.
|
Garry, my comment (and the usage discussed here) was about JFY not SQZ.
| DFSORT Application Programming Guide wrote: |
PREBLANK=list
specifies a list of one or more characters to be changed to blanks before justify processing begins. Only leading and trailing characters are changed to blanks. |
speermb,
You're on the right track with your latest card, just that you don't need the PREBLANK in JFY. Here is what I got when tried on 2 input fields and an input of LRECL=200. You can modify it to include all the input fields as per your data set attributes. Good luck.
SORTIN
| Code: |
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
GBUNITED KINGDOM (ENGLAND, WALES, SCOTLAND, NO. IRELAND UNITED KINGDOM
GDGRENADA GRENADA
GEGEORGIA GEORGIA
GFFRENCH GUIANA FRENCH GUIANA
GGGUERNSEY GUERNSEY
GHGHANA GHANA |
SORTOUT
| Code: |
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
GB,"UNITED KINGDOM (ENGLAND WALES SCOTLAND NO. IRELAND","UNITED KINGDOM",
GD,"GRENADA","GRENADA",
GE,"GEORGIA","GEORGIA",
GF,"FRENCH GUIANA","FRENCH GUIANA",
GG,"GUERNSEY","GUERNSEY",
GH,"GHANA","GHANA", |
| Code: |
OPTION COPY
INREC FINDREP=(IN=C',',OUT=C' ')
OUTFIL IFTHEN=(WHEN=INIT,
BUILD=(1:1,2,C',',
03,55,JFY=(SHIFT=LEFT,LEAD=C'"',TRAIL=C'"',LENGTH=57),C',',
58,40,JFY=(SHIFT=LEFT,LEAD=C'"',TRAIL=C'"',LENGTH=42),C',')),
IFTHEN=(WHEN=INIT,
BUILD=(1,200,SQZ=(SHIFT=LEFT,PAIR=QUOTE))) |
|
|
| Back to top |
|
 |
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1216 Location: Dublin, Ireland
|
|
|
|
| Quote: |
| Garry, my comment (and the usage discussed here) was about JFY not SQZ. |
Garry |
|
| Back to top |
|
 |
speermb
New User
Joined: 27 Aug 2008 Posts: 30 Location: USA
|
|
|
|
Thanks all.
This worked.
I did have to do an additional step to do FINDREP to remove the ", but it works. Is there a better way (or a way to do all at once no idea).
| Code: |
OUTFIL FNAMES=TMPDD01,
IFTHEN=(WHEN=INIT,
BUILD=(1:1,2,C',',
003,055,JFY=(SHIFT=LEFT,
LEAD=C'"',TRAIL=C'"',LENGTH=57),
058,040,JFY=(SHIFT=LEFT,
LEAD=C'"',TRAIL=C'"',LENGTH=42),
098,100,JFY=(SHIFT=LEFT,
LEAD=C'"',TRAIL=C'"',LENGTH=102),
198,100,JFY=(SHIFT=LEFT,
LEAD=C'"',TRAIL=C'"',LENGTH=102),
298,100,JFY=(SHIFT=LEFT,
LEAD=C'"',TRAIL=C'"',LENGTH=102),
398,100,JFY=(SHIFT=LEFT,
LEAD=C'"',TRAIL=C'"',LENGTH=102),
C',',498,1,C',')),
IFTHEN=(WHEN=INIT,
OVERLAY=(1,513,SQZ=(SHIFT=LEFT,PAIR=QUOTE)))
OUTFIL FNAMES=TMPDD03,
REMOVECC,
HEADER1=(C'COUNTRY CODE',C',',
C'COUNTRY NAME',C',',
C'COMMON COUNTRY NAME',C',',
C'COUNTRY STATMENT NAME',C',',
C'OVERRIDE STATEMENT NAME',C',',
C'ROLLED INTO STATEMENT NAME',C',',
C'US TERRITORY (Y/N)',C','),
FINDREP=(INOUT=(C'""',C',',
C'~',C'',
C'"',C''))
|
Thanks for all your help. |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
| Quote: |
I did have to do an additional step to do FINDREP to remove the ",
|
What happened when you did the FINDREP in INREC? Is your actual data any different than what is in the example above? |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|