IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

REFORMATTING WITH JFY CLOBBERING OUTPUT DATA


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
speermb

New User


Joined: 27 Aug 2008
Posts: 30
Location: USA

PostPosted: Thu Nov 08, 2018 7:20 pm
Reply with quote

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?? icon_confused.gif

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
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2010
Location: USA

PostPosted: Thu Nov 08, 2018 8:16 pm
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Thu Nov 08, 2018 8:40 pm
Reply with quote

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
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2010
Location: USA

PostPosted: Thu Nov 08, 2018 9:50 pm
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Thu Nov 08, 2018 10:16 pm
Reply with quote

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
View user's profile Send private message
speermb

New User


Joined: 27 Aug 2008
Posts: 30
Location: USA

PostPosted: Fri Nov 09, 2018 8:31 am
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Nov 09, 2018 6:57 pm
Reply with quote

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
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Fri Nov 09, 2018 7:12 pm
Reply with quote

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
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2010
Location: USA

PostPosted: Fri Nov 09, 2018 8:05 pm
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Nov 09, 2018 8:07 pm
Reply with quote

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
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Mon Nov 12, 2018 3:35 pm
Reply with quote

Quote:
Garry, my comment (and the usage discussed here) was about JFY not SQZ.


icon_redface.gif icon_redface.gif

Garry
Back to top
View user's profile Send private message
speermb

New User


Joined: 27 Aug 2008
Posts: 30
Location: USA

PostPosted: Thu Nov 15, 2018 5:24 pm
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Thu Nov 15, 2018 6:32 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts SCOPE PENDING option -check data DB2 2
No new posts Check data with Exception Table DB2 0
No new posts JCL EXEC PARM data in C Java & MQSeries 2
Search our Forums:

Back to Top