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
 

 

Adding Quotes to Input Records

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

Active User


Joined: 08 Jun 2006
Posts: 356
Location: New York

PostPosted: Wed Mar 05, 2008 11:02 pm    Post subject: Adding Quotes to Input Records
Reply with quote

Hi,

I have an input file with Account ID from 1st to 16th colomn. I want to add single quotes for each input record in 1st and 17th colomn.

Input file looks like below.

0000000000000001
0000000000000002
0000000000000003

Output should look like below:

'0000000000000001'
'0000000000000002'
'0000000000000003'

We have DFSORT. Can we achieve this using DFSORT?

Record length of my Input and output files 23 and Record Format is FB.

Regards,
KSK
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: Wed Mar 05, 2008 11:14 pm    Post subject:
Reply with quote

Here's a DFSORT job that will do what you asked for:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=... input file (FB/23)
//SORTOUT DD DSN=...  output file (FB/23)
//SYSIN    DD    *
  OPTION COPY
  INREC BUILD=(C'''',1,16,C'''',23:X)
/*


If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html
Back to top
View user's profile Send private message
ksk

Active User


Joined: 08 Jun 2006
Posts: 356
Location: New York

PostPosted: Thu Mar 06, 2008 10:48 am    Post subject: Reply to: Adding Quotes to Input Records
Reply with quote

Hi Frank,

Thanks very much for your solution. It is working fine.

I have one more requirement here. I also want to add ,(comma) after last quote of each record.

i.e. output should look like below.

'0000000000000001',
'0000000000000002',
'0000000000000003'

Please note that last record should not have comma but all other prior records should have.

I tried with the following sort card but it is giving comma for last record also.

INREC BUILD=(C'''',1,16,C'''',C',',23:X)

And my actual output records are showing like below.

'0010089589511343',
'0010089589511343',
'0010089589562369',
'0010089589562469',

Last highlited comma should not come in my output.

Please let me know the solution.


Regards,
KSK
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 Mar 06, 2008 9:33 pm    Post subject:
Reply with quote

Here's a DFSORT job for your new requirement:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=... input file (FB/23)
//SYM DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN    DD    *
  OPTION COPY
  OUTFIL FNAMES=SYM,REMOVECC,NODETAIL,
    BUILD=(80X),
    TRAILER1=('LASTRCD,+',COUNT=(M11,LENGTH=8))
/*
//S2    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=... input file (FB/23)
//SORTOUT DD DSN=...  output file (FB/23)
//SYSIN    DD    *
  OPTION COPY
  INREC IFOUTLEN=23,
    IFTHEN=(WHEN=INIT,
      BUILD=(C'''',1,16,C''',',24:SEQNUM,8,ZD)),
    IFTHEN=(WHEN=(24,8,ZD,EQ,LASTRCD),
      OVERLAY=(19:X))
/*
Back to top
View user's profile Send private message
ksk

Active User


Joined: 08 Jun 2006
Posts: 356
Location: New York

PostPosted: Tue Mar 18, 2008 11:46 am    Post subject:
Reply with quote

Thanks Frank. It worked fine.

Regards,
KSK
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 Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am
No new posts Extract set of records matching on ac... bhaskar_kanteti DFSORT/ICETOOL 3 Mon Mar 06, 2017 7:19 am
No new posts Inserting records based on conditions vickey_dw DFSORT/ICETOOL 9 Wed Feb 22, 2017 1:33 pm
No new posts To Merge mutliple records into a sing... anandgbe DFSORT/ICETOOL 6 Wed Feb 22, 2017 8:49 am


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