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

how to add the fields


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

Active User


Joined: 24 Nov 2005
Posts: 121
Location: Tadepalligudem

PostPosted: Tue Feb 07, 2006 2:43 pm
Reply with quote

Hi,

I am having a file with 5 fileds of input, each of 2 characters length......

1010101010

and I have to add each field and add the sum to the end of the record....

so my output should be like...

101010101050

I need to do this only in JCL but not thru COBOL..
is there any chances of making it thru sort only, but not thru icetool.

Thanks,
Rajesh.
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Tue Feb 07, 2006 3:11 pm
Reply with quote

Can you use REXX ?

O.
Back to top
View user's profile Send private message
rajesh_1183

Active User


Joined: 24 Nov 2005
Posts: 121
Location: Tadepalligudem

PostPosted: Tue Feb 07, 2006 3:14 pm
Reply with quote

No Mr.O

Rajesh.
Back to top
View user's profile Send private message
fixdoubts

New User


Joined: 21 Oct 2005
Posts: 54

PostPosted: Tue Feb 07, 2006 4:27 pm
Reply with quote

Hi,

i am not sure this is the optimal way to do it.
But this does what you want.
Code:

//STEP0100 EXEC PGM=SORT                               
//SYSOUT   DD SYSOUT=*                                 
//SORTIN   DD *                               
1010101010                                             
1010101010                                             
//SORTOUT  DD SYSOUT=*                                 
//SYSIN    DD *                                         
  SORT FIELDS=COPY                                     
  OUTREC FIELDS=(1,11,((1,2,ZD,ADD,3,2,ZD),             
                 ADD,(5,2,ZD,ADD,7,2,ZD)),ADD,9,2,ZD)   
/*                                                     
//                                                     

This gives the out put as
Code:

1010101010              50
1010101010              50


Regards,
Back to top
View user's profile Send private message
rajesh_1183

Active User


Joined: 24 Nov 2005
Posts: 121
Location: Tadepalligudem

PostPosted: Tue Feb 07, 2006 5:21 pm
Reply with quote

Hi fixdoubts,

Please fix the error...it is saying POSITIONAL PARAMETER 1 is not valid
POSITIONAL PARAMETER 2 is not valid
POSITIONAL PARAMETER zd is not valid
POSITIONAL PARAMETER ADD is not valid
ADD should have SEQNUM

................when we are doing JJ

and also how u got that 50 at the end...could u explain it...

Thanks,
Rajesh
Back to top
View user's profile Send private message
fixdoubts

New User


Joined: 21 Oct 2005
Posts: 54

PostPosted: Tue Feb 07, 2006 5:46 pm
Reply with quote

Hi,

Could you pls post your job. your are saying its giving error for SYSIN i have not encountered any errors while doing a JJ for any SYSIN errors.

As far as the position of 50 is concerned it will copy the first 11 character from the input (1,11) the rest is the out come of the ADD statements.

Regards,
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: Tue Feb 07, 2006 10:22 pm
Reply with quote

Rajesh,

The following DFSORT job will do what you asked for. It adds the 5 fields as 2-byte ZD values and puts the result in positions 11-12 as a 2-byte ZD value.

Code:

//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
1010101010
//SORTOUT DD SYSOUT=*
//SYSIN DD *
  OPTION COPY
  INREC OVERLAY=(11:1,2,ZD,ADD,3,2,ZD,ADD,5,2,ZD,ADD,
                 7,2,ZD,ADD,9,2,ZD,TO=ZD,LENGTH=2)
/*
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: Tue Feb 07, 2006 10:24 pm
Reply with quote

Quote:
Please fix the error...it is saying POSITIONAL PARAMETER 1 is not valid


Those are certainly not DFSORT error messages. What program are you using? Please show the complete message log.
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 Concatenate 2 fields (usage national)... COBOL Programming 2
No new posts Cobol COMP-2 fields getting scrambled... Java & MQSeries 6
No new posts Converting unpacked fields to pack us... SYNCSORT 4
No new posts Data for newly added fields not displ... IMS DB/DC 6
This topic is locked: you cannot edit posts or make replies. SUM FIELDS=NONE in reverse - Get dupl... DFSORT/ICETOOL 9
Search our Forums:

Back to Top