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

can i replace negative numbers with zero in jcl?


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

Active User


Joined: 05 Oct 2006
Posts: 152

PostPosted: Thu Sep 15, 2011 11:56 am
Reply with quote

hi,

i want to replace any negative number with zero

say eample

input(lrecl=10)

Code:

store1+100
store2+10
store3-50
store4-25
store5+200


my output should be

Code:

store1+100
store2+10
store3+0
store4+0
store5+200

can this be achieved in JCL?

Regds,
useit
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Thu Sep 15, 2011 12:02 pm
Reply with quote

using jcl No
using Your sort product Yes

since You asked for a Yes/no answer that' s what You got icon_cool.gif

as usual post the result of this job so that the good soul willing to provide a solution will know the sort product You are using

Code:

//S1  EXEC PGM=SORT
//SYSOUT    DD SYSOUT=*
//SORTIN    DD *
DUMMY
//SORTOUT   DD SYSOUT=*
//SYSIN     DD *
   OPTION COPY
/*

Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Thu Sep 15, 2011 12:56 pm
Reply with quote

Hi,

this should work with DFSORT or SYNCSORT
Code:
//STEP0100 EXEC PGM=SORT                             
//SYSOUT   DD SYSOUT=*                               
//SORTIN   DD *                                       
STORE1+100                                           
STORE2+10                                             
STORE3-50                                             
STORE4-25                                             
STORE5+200                                           
/*                                                   
//SORTOUT  DD SYSOUT=*                               
//SYSIN    DD *                                       
  SORT FIELDS=COPY                                   
  OUTREC IFTHEN=(WHEN=(7,1,CH,EQ,C'-'),               
                 BUILD=(1,6,C'+0',10:X)),             
         IFTHEN=(WHEN=NONE,                           
                 BUILD=(1,10))                       
/*                                                   



Gerry
Back to top
View user's profile Send private message
useit

Active User


Joined: 05 Oct 2006
Posts: 152

PostPosted: Thu Sep 15, 2011 2:03 pm
Reply with quote

enrico,
please find the below details

Code:

1ICE805I 1 JOBNAME: AAAAAAAA , STEPNAME: S1
 ICE802I 0 BLOCKSET     TECHNIQUE IN CONTROL
 ICE201I H RECORD TYPE IS F - DATA STARTS IN POSITION 1
 ...


Regds,
useit
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Thu Sep 15, 2011 2:06 pm
Reply with quote

well looks like Gerry already gave You the reply!
topic moved to the DFSORT/ICETOOL section

the snippet posted works because of the fixed position of the minus sign,
if the layout is different ( unaligned or right aligned field ) it might not work
Back to top
View user's profile Send private message
useit

Active User


Joined: 05 Oct 2006
Posts: 152

PostPosted: Thu Sep 15, 2011 3:13 pm
Reply with quote

thanx gerry and enrico-sorichetti:) your solution worked for me..

thanx a ton
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Sep 15, 2011 11:30 pm
Reply with quote

useit,

I would suggest this slightly simpler DFSORT job:

Code:

//S2 EXEC PGM=SORT                                                 
//SYSOUT   DD SYSOUT=*                                             
//SORTIN   DD DSN=...  input file (FB/10)                           
//SORTOUT DD DSN=...  output file (FB/10)   
//SYSIN    DD *                                                   
  SORT FIELDS=COPY                                                 
  OUTREC IFTHEN=(WHEN=(7,1,CH,EQ,C'-'),                           
                 OVERLAY=(7:C'+0  ')                             
/*                         
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 Replace each space in cobol string wi... COBOL Programming 3
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Generate random number from range of ... COBOL Programming 3
No new posts replace word 'MONTH' with current mon... SYNCSORT 11
Search our Forums:

Back to Top