Search

Sunday, July 31, 2016

Dynamic php code to get database fields in sql server

Here is small code snippet to display php fields dynamically:

page.php

<?php
....
....
$sql = "SELECT * FROM xyz where student1 ='$user1'";
$stmt = sqlsrv_query($conn, $sql);

                 if( $stmt === false ) {
die( '<pre>'.print_r( sqlsrv_errors(), true).'</pre>' );
};
if( sqlsrv_fetch($stmt) === false ) {
die( '<pre>'.print_r( sqlsrv_errors(), true).'</pre>' );
};

....
....
?>

Php1-Pass a variable from one page to other webpage

How to pass a variable from one webpage to another?

Its the simple command to be given in both the pages:


Mypage.php

<?php
session start();
row=1;
?>

Mypage1.php

<?php
session start ();
echo row;
?>




Tuesday, October 20, 2015

DFSORT - To search for the string from the file when position is not known

Search for a string when its position not known in the file records          

To Search for a particular string within a file when the exact position of that string within a record is not known and to write that record in the Output file, the following SORT card can be used.

//SYSIN    DD  *                                   
        SORT FIELDS=COPY                           
        INCLUDE COND=(1,80,SS,EQ,C'PQ2222222222')  
/*                                                 

Here,
 SS        -   Sub string,
 1         -   Starting position of the range
 80       -   Width of the search range
 EQ      -   Comparison operators

Note:
  1. Only EQ & NE can be used for comparison.
  2. We can even use OMIT COND instead of INCLUDE

Consider input files:

ABC.SORTIN
PQ000003 1000001 PQ2222222222 123                  
PQ000002 1000002 EF1111111111                   
PQ000004 1000002 AB3333333333 530 PQ2222222222    
PQ000003 1000001 CD5555555555 005                  
PQ000001 1000004 RQ1111111111         

PQR.SORTOUT
PQ000003 1000001 PQ2222222222 123              
PQ000004 1000002 AB3333333333 530 PQ2222222222        

We can also use AND/OR to combine conditions

//SYSIN    DD  *                                      
        SORT FIELDS=COPY                              
        INCLUDE COND=(1,80,SS,EQ,C'PQ2222222222',AND, 
                      1,80,SS,EQ,C'AB3333333333')     
/*                    
                               
XYZ.SORTOUT
PQ000004 1000002 AB3333333333 530 PQ2222222222

Wednesday, October 14, 2015

KSDS VSAM file creation in read-only mode


KSDS VSAM file can be made read only By using INHIBIT along with ALTER command

Example:

//STEP1 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
ALTER -
READ1.KSDS.DATA -
INHIBIT
ALTER -
READ1.KSDS.INDEX -
INHIBIT
/*
//

Notice that the ALTER command is used with DATA and INDEX and not with the cluster.