Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

can i replace negative numbers with zero in jcl?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
useit

Active User


Joined: 05 Oct 2006
Posts: 144

PostPosted: Thu Sep 15, 2011 11:56 am    Post subject: can i replace negative numbers with zero in jcl?
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10256
Location: italy

PostPosted: Thu Sep 15, 2011 12:02 pm    Post subject: Reply to: can i replace negative numbers with zero in jcl?
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: 1703
Location: Australia

PostPosted: Thu Sep 15, 2011 12:56 pm    Post subject:
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: 144

PostPosted: Thu Sep 15, 2011 2:03 pm    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10256
Location: italy

PostPosted: Thu Sep 15, 2011 2:06 pm    Post subject: Reply to: can i replace negative numbers with zero in jcl?
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: 144

PostPosted: Thu Sep 15, 2011 3:13 pm    Post subject:
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 Moderator


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

PostPosted: Thu Sep 15, 2011 11:30 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Fileaid Update Replace with null string descann Compuware & Other Tools 4 Mon May 15, 2017 3:00 pm
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm
No new posts Incorrect output when trying to add n... monica1 PL/I & Assembler 10 Fri Jan 13, 2017 5:02 pm
No new posts Row-Numbers of distinct rows? Auryn DB2 1 Thu Oct 20, 2016 4:38 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us