MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Reformat file

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
nadh
Intermediate


Joined: 08 Oct 2004
Posts: 192
Topics: 89

PostPosted: Wed Aug 05, 2009 8:10 am    Post subject: Reformat file Reply with quote

Hi,

I've a input file. From this file I need to include only records having
Back to top
View user's profile Send private message Send e-mail
nadh
Intermediate


Joined: 08 Oct 2004
Posts: 192
Topics: 89

PostPosted: Wed Aug 05, 2009 9:06 am    Post subject: Reply with quote

Hi,

I need to retain Header and Trailer records.

Thanks
Nadh
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Wed Aug 05, 2009 9:35 am    Post subject: Reply with quote

nadh,

You can reformat your input with the following control cards. If you need to retain the header and trailer records , is there any thing that would identify them?

Code:

//SYSIN   DD *
  INCLUDE COND=(1,4,CH,EQ,C'09IN')
  SORT FIELDS=COPY
  OUTREC BUILD=(C'7808',     $ CONSTANT '7808'
                05:10,10,    $ INPUT 10 BYTE FROM POS 10
                15:23,10,    $ INPUT 10 BYTE FROM POS 23
                25:20,03,    $ INPUT 03 BYTE FROM POS 20
                30:10X,      $ SPACES
                40:05,04,    $ INPUT 04 BYTE FROM POS 05
                44:50,04,    $ INPUT 04 BYTE FROM POS 50
                48:C'Y',     $ CONSTANT 'Y' 
                49:23,06,    $ INPUT 06 BYTE FROM POS 23
                55:09,01,    $ INPUT 01 BYTE FROM POS 09
                56:15,08,    $ INPUT 08 BYTE FROM POS 15
                70:X)        $ SPACES UP TO POS 70
//*

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
nadh
Intermediate


Joined: 08 Oct 2004
Posts: 192
Topics: 89

PostPosted: Wed Aug 05, 2009 2:48 pm    Post subject: Reply with quote

Hi,

Thankyou.

Kolusu Header and Trailer records start with ..................pic.
My another issue is with this "Pos 56-63 in reformatted file should be Pos 15-22 in input trailer record " can we do this.

Thanks
Nadh
Back to top
View user's profile Send private message Send e-mail
nadh
Intermediate


Joined: 08 Oct 2004
Posts: 192
Topics: 89

PostPosted: Thu Aug 06, 2009 1:50 am    Post subject: Reply with quote

Hi,

Kolusu I've tried with the code you provided. Its reformatting both header and trailer as well.

In input dataset Header is starting with low values(hex 0000) and Trailer with high values(hex FFFF). I need to include this header and trailer along with detail records, but detail records should be only '09IN' as stated earlier.

My another issue is with this "Pos 56-63 in reformatted file should be Pos 15-22 in input trailer record " please help me out to do this.

Thanks in advance.
Nadh
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Thu Aug 06, 2009 11:31 am    Post subject: Reply with quote

nadh,

You need to show me as to how you need to pick the value from the trailer record. Since the trailer is the last record in your input we need to sort the file or perform another pass to get that value.

Show me a sample of input and desired output

till then here are the control cards which will just reformat the detail records leaving the header and trailer records as is

Code:

//SYSIN    DD *                                           
  INCLUDE COND=(1,2,CH,EQ,X'0000',OR, $ HEADER             
                1,4,CH,EQ,C'09IN',OR, $ DETAIL             
                1,2,CH,EQ,X'FFFF')    $ TRAILER           
  SORT FIELDS=COPY                                         
                                                           
  OUTREC IFTHEN=(WHEN=(1,4,CH,EQ,C'09IN'),                 
  BUILD=(C'7808',     $ CONSTANT '7808'                   
         05:10,10,    $ INPUT 10 BYTE FROM POS 10         
         15:23,10,    $ INPUT 10 BYTE FROM POS 23         
         25:20,03,    $ INPUT 03 BYTE FROM POS 20         
         30:10X,      $ SPACES                             
         40:05,04,    $ INPUT 04 BYTE FROM POS 05         
         44:50,04,    $ INPUT 04 BYTE FROM POS 50         
         48:C'Y',     $ CONSTANT 'Y'                       
         49:23,06,    $ INPUT 06 BYTE FROM POS 23         
         55:09,01,    $ INPUT 01 BYTE FROM POS 09         
         56:15,08,    $ INPUT 08 BYTE FROM POS 15         
         70:X))       $ SPACES UP TO POS 70               
/*

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
nadh
Intermediate


Joined: 08 Oct 2004
Posts: 192
Topics: 89

PostPosted: Thu Aug 06, 2009 1:06 pm    Post subject: Reply with quote

Thank you Kolusu.

The code worked fine. Everything is fine But the data in the below control card
56:15,08, $ INPUT 08 BYTE FROM POS 15 needs to be from trailer record starting from 15, 8 characters instead of 15,08 from input file.

Below is the sample data
Code:

..........PICC20090327234954JES22UTO
09IN02884219003000300326046340840031FLC      000102880
09IN02884219003000300326072480460031FLC      000102880
09IN02884219003000300326072492950031FLC      000102880
09IN02884219003000300326072631480031FLC      000102880
09IN02884219003000300326072822930031FLC      000102880
14NJ50461973948998481997394899848191FLCAEA   000150460
14NJ50464973948998991297394899599121FLCFWI   000150460
14NJ50464973948998991297394899789121FLCWI3   000150460
14NJ03334973948998991297394899899121FLCAESCBP000103330
14NJ50461973948999093397394899909331FLCAEA   000150460
14NJ50462973948999857597394899985751FLCVMA   000150460
..........PICC20090327234954JES22UTO00001049658


The part of output from the control card you provided is as below for the above input
Code:

..........PICC20090327234954JES22UTO                           
780821900300032604634084003            02880288Y260463430003003
780821900300032607248046003            02880288Y260724430003003
780821900300032607249295003            02880288Y260724430003003
780821900300032607263148003            02880288Y260726430003003
780821900300032607282293003            02880288Y260728430003003
780881292699928129269992220            50465046Y812926169992220
780881292699958129269910362                    Y812926469995362
780881292699958129269915362            50465046Y812926469995362
780881292699958129269995362            50465046Y812926469995362
780881292699998129269999511            04320432Y812926169999511
..........PICC20090327234954JES22UTO00001049658     

Everthing is fine but the data 30003003 (56-63) which is 8 char is taken from 15-22 from input file. But the desired one is it should be 20090327 (from 15-22 in Trailer Record).

The desired output is as below
Code:

..........PICC20090327234954JES22UTO                           
780821900300032604634084003            02880288Y260463420090327
780821900300032607248046003            02880288Y260724420090327
780821900300032607249295003            02880288Y260724420090327
780821900300032607263148003            02880288Y260726420090327
780821900300032607282293003            02880288Y260728420090327
780881292699928129269992220            50465046Y812926120090327
780881292699958129269910362                    Y812926420090327
780881292699958129269915362            50465046Y812926420090327
780881292699958129269995362            50465046Y812926420090327
780881292699998129269999511            04320432Y812926120090327
..........PICC20090327234954JES22UTO00001049658 


Please help me.

Thanks
Nadh
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Thu Aug 06, 2009 1:50 pm    Post subject: Reply with quote

nadh,

bonk You have been on this site for a long time and yet you cannot clearly define the requirements.

1. The sample input and output does NOT match. The no: of matching records including the header and trailer record are only 7 ( 5 for 09IN records 1 header and 1 trailer ) Your output shows more records. Where did the extra records come from?

2. The Date you want to pick is also same on the header record, cant you use that? If it is the same date , you can avoid a sort operation and get away with COPY

Assuming you canNOT use the header record value and the output will only have 09in records with header and trailer , the following control cards will give you the desired results

Code:


//SYSIN    DD *                                                       
  INCLUDE COND=(1,2,CH,EQ,X'0000',OR, $ HEADER                       
                1,4,CH,EQ,C'09IN',OR, $ DETAIL                       
                1,2,CH,EQ,X'FFFF')    $ TRAILER                       
                                                                     
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(71:C'0')),                         
  IFTHEN=(WHEN=(1,4,CH,EQ,C'09IN'),OVERLAY=(71:C'1'))                 
                                                                     
  SORT FIELDS=(71,1,CH,A)                                             
                                                                     
  OUTREC IFTHEN=(WHEN=GROUP,BEGIN=(1,2,CH,EQ,X'FFFF'),PUSH=(72:1,70))
                                                                     
  OUTFIL REMOVECC,IFOUTLEN=70,OMIT=(1,2,CH,EQ,X'FFFF'),               
  IFTHEN=(WHEN=(1,4,CH,EQ,C'09IN'),                                   
  BUILD=(C'7808',     $ CONSTANT '7808'                               
         05:10,10,    $ INPUT 10 BYTE FROM POS 10                     
         15:23,10,    $ INPUT 10 BYTE FROM POS 23                     
         25:20,03,    $ INPUT 03 BYTE FROM POS 20                     
         30:10X,      $ SPACES                                       
         40:05,04,    $ INPUT 04 BYTE FROM POS 05                     
         44:50,04,    $ INPUT 04 BYTE FROM POS 50                     
         48:C'Y',     $ CONSTANT 'Y'                                 
         49:23,06,    $ INPUT 06 BYTE FROM POS 23                     
         55:09,01,    $ INPUT 01 BYTE FROM POS 09                     
         56:86,08)),  $ COPY THE DATE FROM TRAILER RECORD             
  TRAILER1=(72,70)                                                   
/*

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
nadh
Intermediate


Joined: 08 Oct 2004
Posts: 192
Topics: 89

PostPosted: Thu Aug 06, 2009 2:38 pm    Post subject: Reply with quote

Kolusu,

I've tried with the code it is giving WER268A OUTREC STATEMENT : SYNTAX ERROR message. Syncsort version is SYNCSORT FOR Z/OS 1.3.1.0R. It is giving the error at this location
Code:

                                                                   
SORT FIELDS=(71,1,CH,A)                                             
                                                                   
OUTREC IFTHEN=(WHEN=GROUP,BEGIN=(1,2,CH,EQ,X'FFFF'),PUSH=(72:1,70))
                    *                                               
                                                                   
OUTFIL REMOVECC,IFOUTLEN=70,OMIT=(1,2,CH,EQ,X'FFFF'),               

WER268A  OUTREC STATEMENT  : SYNTAX ERROR


I'm sorry for the example given its typo error. Please find the precise example below

INPUT File
Code:

..........PICC20090327234954JES22UTO                 
09IN02884219003000300326046340840031FLC      000102880
09IN02884219003000300326072480460031FLC      000102880
09IN02884219003000300326072492950031FLC      000102880
14NJ50461973948999093397394899909331FLCAEA   000150460
14NJ50462973948999857597394899985751FLCVMA   000150460
..........PICC20090327234954JES22UTO00001049658   

OUPUT File after excluding 14NJ and having only 09IN in output file after reformating should be as below
Code:

..........PICC20090327234954JES22UTO                           
780821900300032604634084003            02880288Y260463420090327
780821900300032607248046003            02880288Y260724420090327
780821900300032607249295003            02880288Y260724420090327
..........PICC20090327234954JES22UTO00001049658


As per requirement the date should be picked from Trailer record. I believe the above code you mentioned is for the same. Please give me the sort control cards If client accepts for picking date from header for positon - Pos 56-63 in reformatted file should be Pos 15-22 in input trailer record.

Thank you so much.
Nadh
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Thu Aug 06, 2009 2:48 pm    Post subject: Reply with quote

nadh wrote:
Kolusu,

I've tried with the code it is giving WER268A OUTREC STATEMENT : SYNTAX ERROR message. Syncsort version is SYNCSORT FOR Z/OS 1.3.1.0R. It is giving the error at this location
Code:

                                                                   
SORT FIELDS=(71,1,CH,A)                                             
                                                                   
OUTREC IFTHEN=(WHEN=GROUP,BEGIN=(1,2,CH,EQ,X'FFFF'),PUSH=(72:1,70))
                    *                                               
                                                                   
OUTFIL REMOVECC,IFOUTLEN=70,OMIT=(1,2,CH,EQ,X'FFFF'),               

WER268A  OUTREC STATEMENT  : SYNTAX ERROR


Please give me the sort control cards If client accepts for picking date from header for positon - Pos 56-63 in reformatted file should be Pos 15-22 in input trailer record.


nadh,

Your Error messages indicate you are using syncsort. I'm a DFSORT developer. DFSORT and Syncsort are competitive products. I'm happy to answer questions on DFSORT and DFSORT's ICETOOL, but I don't answer questions on Syncsort.
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
nadh
Intermediate


Joined: 08 Oct 2004
Posts: 192
Topics: 89

PostPosted: Thu Aug 06, 2009 4:21 pm    Post subject: Reformat file using SYNCSORT Reply with quote

Hi,

We are using SyncSort for z/OS 1.3.1. WHEN=GROUP is supported in SyncSort for z/OS 1.3.2.

Please specify the modified code without using WHEN=GROUP.

Thanks
Nadh
Back to top
View user's profile Send private message Send e-mail
nadh
Intermediate


Joined: 08 Oct 2004
Posts: 192
Topics: 89

PostPosted: Thu Aug 06, 2009 7:45 pm    Post subject: Reply with quote

Kolusu,

Quote:

2. The Date you want to pick is also same on the header record, cant you use that? If it is the same date , you can avoid a sort operation and get away with COPY


Please provide the code assuming Date from Header record.

Thanks
Nadh
Back to top
View user's profile Send private message Send e-mail
Terry_Heinze
Supermod


Joined: 31 May 2004
Posts: 391
Topics: 4
Location: Richfield, MN, USA

PostPosted: Thu Aug 06, 2009 8:30 pm    Post subject: Reply with quote

Nadh,
Did you read kolusu's last post?
_________________
....Terry
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group