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

keep position


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

Active User


Joined: 20 May 2010
Posts: 121
Location: canada

PostPosted: Tue Jun 19, 2018 6:44 am
Reply with quote

Hi,

I have file fb 80 ... I need to eliminate for example A in position 1-10, but keep the rest of the record on the same position ... not shift it if I remove A

12345A67 123456
to
1234567 123456

if I use FINDREP it shift last 123456 one position left if I remove A.
Back to top
View user's profile Send private message
mistah kurtz

Active User


Joined: 28 Jan 2012
Posts: 316
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Tue Jun 19, 2018 12:15 pm
Reply with quote

Assuming RECFM=FB and LRECL=80 and you want to replace the 'A' in column 1 to 10 with null, the below sort card should give you the desired output.

Code:
  OPTION COPY                                           
  INREC BUILD=(11,70,1,10)                               
  OUTREC FINDREP=(STARTPOS=71,ENDPOS=80,IN=C'A',OUT=C'')
  OUTFIL BUILD=(71,10,1,70)                             
Back to top
View user's profile Send private message
anatol

Active User


Joined: 20 May 2010
Posts: 121
Location: canada

PostPosted: Tue Jun 19, 2018 4:49 pm
Reply with quote

Thank you, but it's not what I am looking for. In other words - I need put additional blank before second 123456 only if I remove A .... second 123456 could be in any position in record ( this is just sample) . maybe in other words - I need to remove A in first word in the record and add one more blank between first word and second word in the record only if I remove A in first word
Back to top
View user's profile Send private message
mistah kurtz

Active User


Joined: 28 Jan 2012
Posts: 316
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Tue Jun 19, 2018 5:02 pm
Reply with quote

Did you try running with that sort card.

Please post an actual sample of input and expected output.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Tue Jun 19, 2018 5:19 pm
Reply with quote

anatol wrote:
Thank you, but it's not what I am looking for. In other words - I need put additional blank before second 123456 only if I remove A .... second 123456 could be in any position in record ( this is just sample) . maybe in other words - I need to remove A in first word in the record and add one more blank between first word and second word in the record only if I remove A in first word

Perhaps if you could be bothered to tell us exactly what you really wanted, then the members that wish to help you will NOT be wasting their time giving incorrect solutions.

Maybe the expected output that you posted would have been a true reflection of what you wanted, but hey ho after 120+ posts YOU can't be arsed to use the code tags and then moan when the results aren't exactly to your spec.

Unfortunately psychic day was yesterday this week
Back to top
View user's profile Send private message
anatol

Active User


Joined: 20 May 2010
Posts: 121
Location: canada

PostPosted: Tue Jun 19, 2018 5:29 pm
Reply with quote

Sorry, I need just idea, not full solution. Maybe I cannot explain the problem, but I've tried my best.

Here is the result of suggested sort statements:
Code:

//STEP020  EXEC PGM=SORT,PARM='SIZE(MAX)'                         
//SORTIN   DD *                                                   
12345A67 123456                                                   
123A45 123456                                                     
12A34 123456                                                     
//SORTOUT  DD SYSOUT=*                                           
//SYSOUT    DD SYSOUT=*                                           
//SYSIN     DD *                                                 
  OPTION COPY                                                     
   INREC BUILD=(11,70,1,10)                                       
   OUTREC FINDREP=(STARTPOS=71,ENDPOS=80,IN=C'A',OUT=C'')         
   OUTFIL BUILD=(71,10,1,70)                                     


output is:
Code:

        CPU:     0 HR  00 MIN  00.00 SEC    SRB:     0 HR  00 MI
1234567 1 23456                                                 
12345 123 456                                                   
1234 1234 56                                                   
ICE201I 2 RECORD TYPE IS F - DATA STARTS IN POSITION 1         
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Tue Jun 19, 2018 7:24 pm
Reply with quote

Is the output what you want, if not, please show us what you want
Have you tried changing it to a blank, as below rather than a NULL ?
Code:

//SYSIN     DD *                                                 
  OPTION COPY                                                     
   INREC BUILD=(11,70,1,10)                                       
*  OUTREC FINDREP=(STARTPOS=71,ENDPOS=80,IN=C'A',OUT=C'')   
   OUTREC FINDREP=(STARTPOS=71,ENDPOS=80,IN=C'A',OUT=C' ')             
   OUTFIL BUILD=(71,10,1,70)   
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 446
Location: USA

PostPosted: Tue Jun 19, 2018 7:39 pm
Reply with quote

First, PARSE the input record to fixed positions and then use the above sort card. At the end, you need to use SQZ=(SHIFT=LEFT) to get the data in your original format again.

.
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 INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts parsing variable length/position data... DFSORT/ICETOOL 5
No new posts compare two file to find position/dat... SYNCSORT 2
No new posts Group selective VB records - Trailer ... DFSORT/ICETOOL 16
No new posts Position BSAM file on multi volume PL/I & Assembler 3
Search our Forums:

Back to Top