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

How can I do this using sort


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

New User


Joined: 06 Jun 2007
Posts: 58
Location: Hyderabad

PostPosted: Wed Aug 08, 2007 5:59 pm
Reply with quote

Can anyone help,
I have a file which contains some records.In this file at 21st position if I have 'AC' then I need to format the data at 55th position for all the records.How can I do this using sort and also the rest of the records have to be copied?
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Wed Aug 08, 2007 6:14 pm
Reply with quote

shchan
You can do the this using IFTHEN clause.
Quote:
then I need to format the data at 55th position

Give the sample of i/p and o/p datasets, LRECL and RECFM, and elaborate about reformatting.

In the link

Use [URL] BBCode for External Links

you find z/OS DFSORT: Getting Started and other books on DFSORT/ICETOOL. Which will help you in knowing about DFSORT and its features.

Also Check the topic Reformatting Records with IFTHEN at http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ice1cg20/2.4.16?ACTION=MATCHES&REQUEST=IFTHEN&TYPE=FUZZY&SHELF=ICE1SH20&DT=20060615173822&CASE=&searchTopic=TOPIC&searchText=TEXT&searchIndex=INDEX&rank=RANK&ScrollTOP=FIRSTHIT#FIRSTHIT
Back to top
View user's profile Send private message
shchan

New User


Joined: 06 Jun 2007
Posts: 58
Location: Hyderabad

PostPosted: Wed Aug 08, 2007 6:34 pm
Reply with quote

When it contains AC i want to pad 4 zeroes at 32nd position
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Wed Aug 08, 2007 7:50 pm
Reply with quote

Unless I'm missing something here, wouldn't it be a simple:

Code:

//STEP1   EXEC PGM=SORT                               
//SORTIN  DD   DSN=VV8.RECORD.SORTEX,DISP=SHR               
//SYSOUT  DD   SYSOUT=*                               
//SORTOUT DD   DSN=VV8.RECORD.SORTRES1,             
//        DISP=(,CATLG,DELETE),UNIT=SYSDA,     
//        SPACE=(TRK,(1,1),RLSE)
//SYSIN   DD   *                                       
  OPTION COPY     
  OUTREC IFTHEN=(WHEN=(21,2,CH,EQ,C'AC'),
    OVERLAY=(32:C'0000'))
/* 
Back to top
View user's profile Send private message
shchan

New User


Joined: 06 Jun 2007
Posts: 58
Location: Hyderabad

PostPosted: Wed Aug 08, 2007 8:02 pm
Reply with quote

Thank you so much superk..it worked..
Back to top
View user's profile Send private message
shchan

New User


Joined: 06 Jun 2007
Posts: 58
Location: Hyderabad

PostPosted: Wed Aug 08, 2007 8:05 pm
Reply with quote

But can u please tell me how to do the same thing using ICETOOL. Actually as far as formatting is concerned I want the 4 digits from 32 position to be moved to 36th and they should be preceeded by 4 zeroes.
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: Wed Aug 08, 2007 8:13 pm
Reply with quote

Here's how you do the same thing with DFSORT's ICETOOL:

Code:

//STEP1   EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN  DD   DSN=VV8.RECORD.SORTEX,DISP=SHR
//OUT DD   DSN=VV8.RECORD.SORTRES1,
//        DISP=(,CATLG,DELETE),UNIT=SYSDA,
//        SPACE=(TRK,(1,1),RLSE)
//TOOLIN  DD   *
COPY FROM(IN) TO(OUT) USING(CTL1)
//CTL1CNTL DD *
  OUTREC IFTHEN=(WHEN=(21,2,CH,EQ,C'AC'),
    OVERLAY=(32:C'0000'))
/*


Quote:
I want the 4 digits from 32 position to be moved to 36th and they should be preceeded by 4 zeroes.


To show you how to do that, I need you to tell me the RECFM and LRECL of your input file and output file. Since you're adding 4 bytes to those records, do you want to remove the last 4 bytes from those records, or do you want to expand all of the records by 4 bytes. It would be best if you showed an example of your input records and expected output records.

You could have saved everyone time by giving the details of what you wanted in your first post. Please do that in the future.
Back to top
View user's profile Send private message
shchan

New User


Joined: 06 Jun 2007
Posts: 58
Location: Hyderabad

PostPosted: Wed Aug 08, 2007 8:37 pm
Reply with quote

Thanks Frank.I will try to give all the details next time in my first post only
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 How to split large record length file... DFSORT/ICETOOL 10
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
No new posts how to calculate SUM for VB file usin... JCL & VSAM 1
Search our Forums:

Back to Top