want some help on findrep



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

want some help on findrep

Postby shub2204 » Tue Jul 16, 2019 2:39 pm

I have a file FB lrecl 458 , on column 300 to 339 i want to replace comma with spaces and comma can be present anywhere in between this position.
here is my sortcard but it is not giving correct results

SORT FIELDS=COPY
OUTREC TFTHEN=(WHEN=INIT
FINDREP=(STARTPOS=300,ENDPOS=339,INOUT=(C',',C' '))
 

Any help will be appreciated
shub2204
 
Posts: 6
Joined: Tue Jul 16, 2019 2:33 pm
Has thanked: 2 times
Been thanked: 0 time

Re: want some help on findrep

 

Re: want some help on findrep

Postby NicC » Tue Jul 16, 2019 3:21 pm

Try posting in the correct forum first of all. A sort question goes to one of the sort forums, not Site Announcements.
Also use the code tags to present your sort control statements, data, JCL program code and anything else that needs a fixed pitch font. I have fixed it up for you this time.
What do you mean by "not giving correct results"? Show any error messages or sample input and incorrect output.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic

These users thanked the author NicC for the post:
shub2204 (Tue Jul 16, 2019 6:20 pm)
NicC
Global moderator
 
Posts: 2999
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: want some help on findrep

Postby NicC » Tue Jul 16, 2019 6:24 pm

INREC IFTHEN=(WHEN=INIT,
FINDREP=(STARTPOS=300,ENDPOS=339,IN=X'6b',OUT=X'40'))


You have a couple of typos in your post - you should cut and paste instead of re-writing:
TFTHEN instead of IFTHEN
Comma missing after INIT
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2999
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: want some help on findrep

Postby shub2204 » Tue Jul 16, 2019 6:34 pm

Hi Nic,

Thank for quick reply..here is my input record.

input

300col                                  339 col(on comma it is 340)
AMAZON EU SAR, UK BRANCH                 ,datatdatdatatatattaatta
AMAZON EU SAR, UK BRANCH                 ,datatatattatatatatatataa    
 


i want to remove any comma coming in between position 300 to 339 to spaces.
using above sort card result look like this


AMAZON EU SAR  UK BRANCH                 ,datatdatdatatatattaatta
AMAZON EU SAR, UK BRANCH                  datatatattatatatatatataa
 


commas are getting replaced randomly..like it is replacing commas with spaces in columns which are not in start and end pos
shub2204
 
Posts: 6
Joined: Tue Jul 16, 2019 2:33 pm
Has thanked: 2 times
Been thanked: 0 time

Re: want some help on findrep

Postby NicC » Tue Jul 16, 2019 6:56 pm

Unfortunately the version of DFSort that I have access to is so old that it does not appear to support FINDREP. Maybe someone else can come up with a solution.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic

These users thanked the author NicC for the post:
shub2204 (Tue Jul 16, 2019 7:04 pm)
NicC
Global moderator
 
Posts: 2999
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: want some help on findrep

Postby willy jensen » Wed Jul 17, 2019 3:19 am

This seems to work
//S1       EXEC PGM=SORT                                              
//SYSOUT   DD SYSOUT=*                                                
//SORTOUT  DD SYSOUT=*                                                
//SORTIN   DD *                                                        
AMAZON EU SAR, UK BRANCH                 ,datat,dat,datata,tattaatta  
AMAZON EU SAR, UK BRANCH                 ,datatat,at,tatat,atatatataa  
//SYSIN    DD *                                                        
 SORT FIELDS=COPY                                                      
 INREC IFTHEN=(WHEN=INIT,                                              
 FINDREP=(STARTPOS=20,ENDPOS=60,IN=C',',OUT=C' '))                    

Result:
AMAZON EU SAR, UK BRANCH                  datat dat datata tattaatta  
AMAZON EU SAR, UK BRANCH                  datatat at tatat atatatataa  
willy jensen
 
Posts: 305
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 42 times

Re: want some help on findrep

Postby shub2204 » Wed Jul 17, 2019 1:52 pm

Hi Willy

Thanks for reply..
i have a file length of 480 and i want to remove comma and replace them with spaces ..if they occur anywhere between position 300 to 339
using above sort card my commas are replacing randomly like anywhere in pos 2 then in pos 41 wherever it is encountering comma,,but randomly for next record it is not replacing comma at 2 and 41..then for next it is replacing at other location.
shub2204
 
Posts: 6
Joined: Tue Jul 16, 2019 2:33 pm
Has thanked: 2 times
Been thanked: 0 time

Re: want some help on findrep

Postby willy jensen » Wed Jul 17, 2019 2:41 pm

Ok I set up a test with a FB 480 dataset and control data
SORT FIELDS=COPY                                      
 INREC IFTHEN=(WHEN=INIT,                              
 FINDREP=(STARTPOS=300,ENDPOS=339,IN=C',',OUT=C' '))  

Input
   WJ.DS.FB480                                     Columns 00295 00366
+----0----+----1----+----2----+----3----+----4----+----5----+----6----+-
a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,
b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,
c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,

output
   WJ.DS.FB480.OUT                                 Columns 00295 00366
+----0----+----1----+----2----+----3----+----4----+----5----+----6----+-
a,a,a a a a a a a a a a a a a a a a a a a a a,a,a,a,a,a,a,a,a,a,a,a,a,a,
b,b,b b b b b b b b b b b b b b b b b b b b b,b,b,b,b,b,b,b,b,b,b,b,b,b,
c,c,c c c c c c c c c c c c c c c c c c c c c,c,c,c,c,c,c,c,c,c,c,c,c,c,

Still looks ok to me. Are you absolutely sure that you are using control data like shown here?
willy jensen
 
Posts: 305
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 42 times

Re: want some help on findrep

Postby NicC » Wed Jul 17, 2019 4:18 pm

shub2204 - (STARTPOS=300,ENDPOS=339,INOUT=(C',',C' '))
Willy - (STARTPOS=300,ENDPOS=339,IN=C',',OUT=C' '))
Note the difference.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2999
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: want some help on findrep

Postby shub2204 » Wed Jul 17, 2019 4:49 pm

hi Willy,

Let me show you using images..as paste is disabled via remote desktop


check the images here:
[url]
https://photos.app.goo.gl/W3FTABcbrjuEdgwb9
[/url]

as i image you can see instead of spaces to be replaced by comma , commas are getting replaced at other positions..can't seem to figure out what is the issue..though sort card is perfect.
shub2204
 
Posts: 6
Joined: Tue Jul 16, 2019 2:33 pm
Has thanked: 2 times
Been thanked: 0 time

Next

Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post